MCPcopy
hub / github.com/tldraw/tldraw / requestAnimationFrame

Method requestAnimationFrame

packages/utils/src/lib/timers.ts:102–107  ·  view source on GitHub ↗

* Requests an animation frame that will be tracked under the specified context. * @param contextId - The context identifier to group this animation frame under. * @param callback - The function to execute on the next animation frame. * @returns The request ID that can be used with cancelAnimat

(contextId: string, callback: FrameRequestCallback)

Source from the content-addressed store, hash-verified

100 * @public
101 */
102 requestAnimationFrame(contextId: string, callback: FrameRequestCallback): number {
103 const id = window.requestAnimationFrame(callback)
104 const current = this.rafs.get(contextId) ?? []
105 this.rafs.set(contextId, [...current, id])
106 return id
107 }
108
109 /**
110 * Disposes of all timers associated with the specified context.

Callers 15

forContextMethod · 0.95
timers.test.tsFile · 0.80
MenuClickCaptureFunction · 0.80
constructorMethod · 0.80
onTouchEndFunction · 0.80
onGestureEndFunction · 0.80
PatternFillDefForCanvasFunction · 0.80
EditLinkDialog.tsxFile · 0.80
loopFunction · 0.80
TldrawUiInput.tsxFile · 0.80

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected