Skip to content

API reference / Common / OverlayManager

Class: OverlayManager ​

Reconciles the registered OverlaySources against a container element each painted frame: creates newly-appeared items, repositions and refreshes the rest, and removes items whose key vanished (a page scrolled off). Sources render in registration order, which is also their stacking order (later sources paint above earlier ones). Positioning is a single transform per item — the cheap path the browser can keep on the compositor.

Constructors ​

Constructor ​

ts
new OverlayManager(container): OverlayManager;

Parameters ​

ParameterType
containerHTMLElement

Methods ​

set() ​

ts
set(id, source): void;

Register (or replace) the overlay under id. Re-renders immediately against the last frame's pages, so an overlay set after the document is already on screen shows up without waiting for the next paint. Ids prefixed udoc: are the built-ins — replace or remove them to take over a built-in overlay.

Parameters ​

ParameterType
idstring
sourceOverlaySource

remove() ​

ts
remove(id): boolean;

Remove the overlay under id (and its elements). False if unknown.

Parameters ​

ParameterType
idstring

render() ​

ts
render(frame): void;

Reconcile the overlay DOM against one painted frame.

Parameters ​

ParameterType
frameOverlayFrame

clear() ​

ts
clear(): void;

Remove every overlay element and registration (document close/teardown).