@mocanvas/editor · class

PerformanceApiAdapter

declare class PerformanceApiAdapter

Mirrors the editor's timing events into the browser's own Performance timeline, and collects long-animation-frame reports.

The point is that a person profiling a canvas should see the editor's spans — "translating", "camera", "frame" — in the same devtools flame chart as everything else, instead of having to correlate two timelines by eye. It writes performance.mark / performance.measure entries and nothing else; it never reports anywhere, and it holds no reference to the document.

Construct one against editor.performance and call dispose when the editor goes away.


Methods · 3

constructor(performance_: PerformanceManager, options?: PerformanceApiAdapterOptions)
dispose(): void

Stop listening, stop observing, and forget the samples.

getFrameTimeStats(): TLPerfFrameTimeStats | null

Frame-time statistics over the last FRAME_WINDOW frames, or null before any.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.