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 the iframeFactory option).
  • The shared RpcBroker — routes inbound RPC messages from any add-on
    channel to the live window.eLabSDK2 surface.
  • The mounted-add-on registry (sdkPluginID → iframe + channel),
    keyed so mountAddon is idempotent.

Lifecycle:

  • mountAll(addons) filters inactive / rootVar-less add-ons and mounts
    the rest in parallel; per-add-on errors surface via onAddonError
    instead of failing the whole call.
  • mountAddon(addon) loads the script, creates the iframe, opens the
    channel, and registers it with the broker. Re-checks disposed
    after every await so a dispose during script-load or iframe-create
    doesn't leave a leaked iframe.
  • reinitAll() posts a reinit message on every channel — the
    iframe-side bootstrap re-runs the add-on's init() 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