Bind an API object emitted by api$ observable to handle messages from other parts of the extension.
This can only used once per channelName per process.
Changing source api object is possible by emitting it from the api$ observable.
Before destroying/disabling an exposed api object, emit a null on api$ to stop monitoring it.
Methods returning Promises will await until the first api object is emitted.
Subscriptions to observable properties are kept active until shutdown() method is called.
This allows changing the observed api object without having to resubscribe the properties.
Observable properties are completed only on calling shutdown().
NOTE: All Observables are subscribed when this function is called and an api object is emitted by api$.
Caches and replays (1) last emission upon remote subscription (unless item === null).
In addition to errors thrown by the underlying API, methods can throw TypeError
Returns
object that can be used to shutdown all ports (shuts down 'messenger' dependency)
Bind an API object emitted by
api$
observable to handle messages from other parts of the extension.api
object is possible by emitting it from theapi$
observable.api
object, emit anull
on api$ to stop monitoring it.Promises
will await until the firstapi
object is emitted.shutdown()
method is called. This allows changing the observedapi
object without having to resubscribe the properties.shutdown()
.NOTE: All Observables are subscribed when this function is called and an
api
object is emitted byapi$
. Caches and replays (1) last emission upon remote subscription (unless item === null).In addition to errors thrown by the underlying API, methods can throw TypeError
Returns
object that can be used to shutdown all ports (shuts down 'messenger' dependency)