Methods
(async) addCallback(descriptor, handler) → {Promise.<{id: string, unsubscribe: function(): Promise.<void>}>}
Subscribes handler to a BiDi event. All the actual subscription-lifecycle work — remote subscribe/unsubscribe, per-subscription bookkeeping — lives on the connection itself (see Index#addCallback in bidi/index.js); Domain only adds the one thing the connection can't do on its own: parsing a delivered payload through the descriptor's type before the caller's handler runs.
Parameters:
| Name | Type | Description |
|---|---|---|
descriptor | ||
handler | function | Invoked with the event's params (parsed through descriptor.type first, if one was given) each time it fires. |
- Source
Returns:
A handle for this subscription — call unsubscribe() to stop receiving the event.
- Type:
- Promise.<{id: string, unsubscribe: function(): Promise.<void>}>