()
| 38 | let timeoutId: number; |
| 39 | let animationFrameId: number; |
| 40 | function cleanup() { |
| 41 | callback = noop; |
| 42 | try { |
| 43 | if (animationFrameId !== undefined && typeof cancelAnimationFrame === 'function') { |
| 44 | cancelAnimationFrame(animationFrameId); |
| 45 | } |
| 46 | if (timeoutId !== undefined) { |
| 47 | clearTimeout(timeoutId); |
| 48 | } |
| 49 | } catch { |
| 50 | // Clearing/canceling can fail in tests due to the timing of functions being patched and unpatched |
| 51 | // Just ignore the errors - we protect ourselves from this issue by also making the callback a no-op. |
| 52 | } |
| 53 | } |
| 54 | timeoutId = setTimeout(() => { |
| 55 | callback(); |
| 56 | cleanup(); |
no test coverage detected
searching dependent graphs…