Interface: OverlayPlugin
Interface for overlay plugins that attach interactive UI on top of the stage.
Overlays are mounted via stage.overlay(plugin) and receive an OverlayContext
with navigation methods and event subscriptions.
Example
const myOverlay: OverlayPlugin = {
mount(ctx) {
const btn = document.createElement("button");
btn.textContent = "Next";
btn.addEventListener("click", () => ctx.next());
ctx.container.appendChild(btn);
},
show() {},
hide() {},
destroy() {},
};
stage.overlay(myOverlay);
Properties
| Property | Type | Description |
|---|---|---|
id? | string | Optional unique identifier for the overlay plugin. |
Methods
destroy()
destroy():
void
Remove overlay from the DOM and clean up all listeners.
Returns
void
getMetrics()?
optionalgetMetrics():Record<string,unknown>
Optional metrics reporter for dev diagnostics.
Returns
Record<string, unknown>
hide()
hide():
void
Hide the overlay.
Returns
void
mount()
mount(
ctx:OverlayContext):void
Called once when the overlay is attached to the stage.
Parameters
| Parameter | Type |
|---|---|
ctx | OverlayContext |
Returns
void
show()
show():
void
Show the overlay.
Returns
void