MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / requestAnimationFrame

Function requestAnimationFrame

packages/core/animation-frame/index.ts:77–90  ·  view source on GitHub ↗
(cb: FrameRequestCallback)

Source from the content-addressed store, hash-verified

75}
76
77export function requestAnimationFrame(cb: FrameRequestCallback): number {
78 const animId = getNewId();
79 if (!inAnimationFrame) {
80 ensureCurrentFrameScheduled();
81 currentFrameAnimationCallbacks[animId] = zonedCallback(cb) as FrameRequestCallback;
82 return animId;
83 }
84 ensureNative();
85 nextFrameAnimationCallbacks[animId] = zonedCallback(cb) as FrameRequestCallback;
86 shouldStop = false;
87 fpsCallback.start();
88
89 return animId;
90}
91
92export function cancelAnimationFrame(id: number): void {
93 delete currentFrameAnimationCallbacks[id];

Callers

nothing calls this directly

Calls 4

getNewIdFunction · 0.85
ensureNativeFunction · 0.70
startMethod · 0.45

Tested by

no test coverage detected