onInit()
1. Signature
onInit(listener: (ctx: InitContext, info: InitInfo) => void): () => void;
-
listener— receives the normalizedInitContextand anInitInfometadata object. -
Returns an unsubscribe function: call it to remove the listener.
2. The four InitSource values
info.source tells you how the emission was produced:
InitSource |
Meaning |
|---|---|
|
The first accepted |
|
The bridge read after |
|
A host call of the installed |
|
The detection cap elapsed without bridge or event; the promise and the listener both observe the degraded state. |
3. Semantics
-
Fires on settle. The first settlement delivers the context to all
onInitlisteners with the matchingsource. -
Replay for late subscribers. If the init has already settled (for example a framework registers its listener only after mount), the listener fires immediately with the settled context and its original source — late registration never misses the init.
-
Rich-client re-emission. In the rich client the init can re-emit: a first
osDashletInitcallback arriving after an earlier self-initialization (or a callback beating the detection poll tick) delivers a fresh context withsource: 'richClientCallback'. Subsequent callbacks route toonUpdateinstead. -
Listener errors. An exception thrown by an
onInitlistener (normal or replay delivery) is routed toonErrorlisteners — it never breaks the host call or the other listeners.