eLabSDK2.Bootloader.AddonHost
Top-level orchestrator for the sandboxed add-on bootloader. One instance
per host page (constructed once in setupAddonHost). Owns:
- The iframe factory (real
<iframe sandbox>in prod, in-process fake in unit tests via theiframeFactoryoption). - The shared RpcBroker — routes inbound RPC messages from any add-on
channel to the live
window.eLabSDK2surface. - The mounted-add-on registry (
sdkPluginID→ iframe + channel), keyed somountAddonis idempotent.
Lifecycle:
mountAll(addons)filters inactive / rootVar-less add-ons and mounts the rest in parallel; per-add-on errors surface viaonAddonErrorinstead of failing the whole call.mountAddon(addon)loads the script, creates the iframe, opens the channel, and registers it with the broker. Re-checksdisposedafter everyawaitso a dispose during script-load or iframe-create doesn't leave a leaked iframe.reinitAll()posts areinitmessage on every channel — the iframe-side bootstrap re-runs the add-on'sinit()so it can re-register UI for a new SPA route. Iframe / port stay alive.unmountAddon(id)/dispose()close the channel, destroy the iframe, and drop registry entries; both are idempotent.
Add-on errors (script load failure, init/reinit throw, host-invoked
handler reject) bubble through the broker → onAddonError callback;
UI rendering / debouncing is the consumer's responsibility.
Methods
reinitAll
reinitAll(): void
Re-invokes init(config, addonContext) on every currently-mounted add-on.
Mirrors the legacy window.runAddons()-on-route-change behaviour: gives
each add-on a chance to re-register page-specific UI (action buttons,
notices, sections) when the user navigates between SPA routes. The iframe
itself is not torn down or rebuilt — the existing port and SDK proxy are
reused, only the add-on's own init function is invoked again.
Returns
void
© 2026 eLabNext
Updated about 16 hours ago