Callbacks
Registers, replaces or removes the functions the host calls with live updates.
bridge.setCallbacks(callbacks) // → voidParameters
callbacks
object | null
yes
Any of the six callback names below. Omitted keys stay as they are; null for a key removes that callback; setCallbacks(null) removes all six
A value that isn't a function or null is reported through sendError, and that key is skipped.
onThemeUpdated
The same object getTheme() resolves with
✅ light/dark and branding changes
✅ light/dark (or a reload), and late-loading fonts
onHistoricalDataUpdated
{ streams }, as from getHistoricalData
✅ after a RANGE_PICKER subscription
— never emitted
onMapDataUpdated
{ points }, as from getMapData
✅ after a RANGE_PICKER subscription
— never emitted
onError
A human-readable message string
✅
✅
Example
bridge.setCallbacks({
onValueUpdated: (v) => applyValue(v.index, v),
onThemeUpdated: (theme) => applyTheme(theme),
onHistoricalDataUpdated: ({ streams }) => renderChart(streams),
onMapDataUpdated: ({ points }) => drawTrack(points),
onDeviceMetadataUpdated: (descriptor) => renderMetadata(descriptor),
onError: (message) => showErrorBanner(message)
});
bridge.setCallbacks({ onDeviceMetadataUpdated: null }); // remove oneRegister callbacks before the initial reads, and make rendering safe to repeat.
onDeviceMetadataUpdatedsuppresses identical snapshots and gets a shallow copy of the descriptor.Synchronous exceptions thrown by a callback are caught and logged; exceptions from
onErrorare swallowed. A rejected Promise from anasynccallback is not caught — handle it inside the callback.onErrorruns only whileisOnErrorEnabledistrue(the default).
Was this helpful?

