onUpdate()

The reserved update slot of the Dashlet handle. It receives the normalized InitContext again whenever the host reports a selection or context change after the init has settled. Full update semantics are a later change — the slot is the stable, already-wired entry point for them.

1. Signature

onUpdate(listener: (ctx: InitContext, info: UpdateInfo) => void): () => void;
  • listener — receives the freshly normalized InitContext (the same shape as init) and an UpdateInfo object whose source is always 'update'.

  • Returns an unsubscribe function.

2. What routes here

Source event Environment

onUpdate messages from the host

webclient

later onInit messages (dashboard switch-back — the init already settled on the first one)

webclient

rich-client host callbacks after the first one (the first callback is the init; later ones are updates)

rich client

the v10.10 warm-up refresh (empty environment at client start; the re-emit carries the populated values once they appear)

rich client

Everything is delivered as the normalized InitContext — the listener does not need to know which event type triggered the emission.

3. Notes

  • Listeners registered before the init settles never fire from the settle itself — the settle goes to onInit (and the init promise); updates start with the first post-settle event.

  • An exception thrown by an onUpdate listener is routed to onError listeners — it never breaks the host call or the other listeners.

4. Examples

const off = dashlet.onUpdate((ctx, info) => {
    // info.source === 'update' always
    rerender(ctx);
});

// later
off(); // unsubscribe