MCPcopy
hub / github.com/angular/angular / cleanup

Function cleanup

packages/core/src/util/callback_scheduler.ts:40–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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();

Callers 5

onLoadMethod · 0.50
onErrorMethod · 0.50
handleMethod · 0.50

Calls 1

clearTimeoutFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…