@mocanvas/editor · class

PerformanceManager

declare class PerformanceManager

A small, self-contained sink for the editor's own timing events.

It is deliberately not the editor's main EventEmitter: performance listeners are diagnostics, they come and go with a profiler or a dev overlay, and nothing in the editor should behave differently because one is attached. A listener that throws is contained here rather than breaking the frame that emitted the event.

Reach it as editor.performance; it is disposed with the editor.


Methods · 5

dispose(): void

Drop every listener. Further on() calls are no-ops.

emit<K extends PerformanceEventName>(name: K, info: PerformanceEvents[K]): void

Report an event. Never throws: diagnostics must not break the editor.

hasListeners(name: PerformanceEventName): boolean

Whether anything is listening. Callers skip building info when not.

on<K extends PerformanceEventName>(name: K, listener: Listener<K>): () => void

Listen to an event. Returns a function that removes the listener.

once<K extends PerformanceEventName>(name: K, listener: Listener<K>): () => void

Listen to the next occurrence only. Returns a function that cancels it.

Mentioned here

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.