Every line of 'react native settimeout' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
370 setTimeout (fn, time = 0, state = TimerState.CLEAR) { 371 this.clearTimeout(); 372 if (window) { 373 this.timerState = state; 374 this.timer = window.setTimeout(() => { 375 this.timerState = TimerState.CLEAR; 376 fn(); 377 }, time); 378 } 379 }
85 export function useClearTimeout( timeout ) { 86 useEffect( () => { 87 return () => { 88 window.clearTimeout( timeout ); 89 }; 90 }, [ timeout ] ); 91 }
127 function _setTimeout(fn, ms) { 128 var start = Date.now(); 129 130 process.nextTick(fakeSetTimeout); 131 132 function fakeSetTimeout() { 133 if (Date.now() < start + ms) { 134 process.nextTick(fakeSetTimeout); 135 return; 136 } 137 138 fn(); 139 } 140 }
6 export function useTimeout( 7 callback: () => any, 8 delay: number | null, 9 memo?: any[] 10 ): void { 11 const savedCallback: React.MutableRefObject<(() => any) | undefined> = useRef(); 12 13 useEffect( 14 () => { 15 savedCallback.current = callback; 16 }, 17 [callback, Array.isArray(memo) ? memo : ""] 18 ); 19 20 useEffect( 21 () => { 22 function tick(): void { 23 if (isFunction(savedCallback.current)) { 24 savedCallback.current(); 25 } 26 } 27 28 if (delay !== null) { 29 const id: number = window.setTimeout(tick, delay); 30 return (): void => window.clearTimeout(id); 31 } 32 }, 33 [delay, Array.isArray(memo) ? memo : ""] 34 ); 35 }
253 value: function setTimeout(handler) { 254 var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { delay: 0 }; 255 256 return this[_setTimer](handler, time); 257 }
9 static setTimeout(fn, millis) { 10 return global.setTimeout(fn, millis); 11 }
38 function setTimeout(fn,delay) { 39 return setTimer( 40 /*keepGoing=*/false, 41 /*callback=*/fn, 42 /*interval=*/delay, 43 /*args=*/[].slice.call(arguments,2) 44 ); 45 }
12 function useInterval(delay, callback) { 13 const savedCallback = Hooks.useRef(); 14 15 // Remember the latest callback. 16 Hooks.useEffect(() => { 17 savedCallback.current = callback; 18 }, [callback]); 19 20 // Set up the interval. 21 Hooks.useEffect(() => { 22 function tick() { 23 savedCallback.current(); 24 } 25 if (delay !== null) { 26 let id = setInterval(tick, delay); 27 return () => clearInterval(id); 28 } 29 }, [delay]); 30 }
474 Stream.prototype.setTimeout = function setTimeout(time) {};
552 client.setTimeout = function setTimeout(t) { 553 client._queryTimeout = t; 554 };