File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,14 @@ if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
88}
99
1010let rafUUID = 0 ;
11+
1112const rafIds = new Map < number , number > ( ) ;
1213
1314function cleanup ( id : number ) {
1415 rafIds . delete ( id ) ;
1516}
1617
17- export default function wrapperRaf ( callback : ( ) => void , times = 1 ) : number {
18+ const wrapperRaf = ( callback : ( ) => void , times = 1 ) : number => {
1819 rafUUID += 1 ;
1920 const id = rafUUID ;
2021
@@ -39,10 +40,12 @@ export default function wrapperRaf(callback: () => void, times = 1): number {
3940 callRef ( times ) ;
4041
4142 return id ;
42- }
43+ } ;
4344
4445wrapperRaf . cancel = ( id : number ) => {
4546 const realId = rafIds . get ( id ) ;
4647 cleanup ( realId ) ;
4748 return caf ( realId ) ;
4849} ;
50+
51+ export default wrapperRaf ;
You can’t perform that action at this time.
0 commit comments