File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -95,14 +95,13 @@ class TextLoop extends React.PureComponent<Props, State> {
95
95
this . tickLoop = requestTimeout ( this . tick , currentInterval ) ;
96
96
} , delay ) ;
97
97
} else {
98
- this . setState (
99
- ( state , props ) => {
100
- const { currentWordIndex } = state ;
98
+ this . setState ( ( state , props ) => {
99
+ const { currentWordIndex : _currentWordIndex } = state ;
101
100
102
- return updatedState = {
101
+ return {
103
102
currentInterval : Array . isArray ( props . interval )
104
103
? props . interval [
105
- currentWordIndex % props . interval . length
104
+ _currentWordIndex % props . interval . length
106
105
]
107
106
: props . interval ,
108
107
} ;
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ declare global {
10
10
}
11
11
}
12
12
13
+ declare interface Handle {
14
+ value : number | void ;
15
+ }
16
+
13
17
const requestAnimFrame = ( ( ) : Function => {
14
18
if ( typeof window !== "undefined" ) {
15
19
return (
@@ -27,7 +31,7 @@ const requestAnimFrame = ((): Function => {
27
31
return ( ) : void => { } ;
28
32
} ) ( ) ;
29
33
30
- export type RequestTimeout = number | void ;
34
+ export type RequestTimeout = object | number | void ;
31
35
/*
32
36
* Behaves the same as setTimeout except uses requestAnimationFrame() where possible for better performance
33
37
* @param {function } fn The callback function
@@ -52,7 +56,7 @@ export const requestTimeout = function(
52
56
53
57
const start = new Date ( ) . getTime ( ) ;
54
58
55
- const handle : object = new Object ( ) ;
59
+ const handle : Handle = { value : 0 } ;
56
60
57
61
function loop ( ) : number | void {
58
62
const current = new Date ( ) . getTime ( ) ;
You can’t perform that action at this time.
0 commit comments