* Set a timeout and remember its ID. * All stored timeouts will be cleared when component unmounts. * @returns a "cancel" function that will clear timeout when invoked.
(callback: () => void, timeout?: number)
| 52 | * @returns a "cancel" function that will clear timeout when invoked. |
| 53 | */ |
| 54 | public setTimeout(callback: () => void, timeout?: number) { |
| 55 | const handle = window.setTimeout(callback, timeout); |
| 56 | this.timeoutIds.push(handle); |
| 57 | return () => window.clearTimeout(handle); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Clear all known timeouts. |
no outgoing calls
no test coverage detected