Page Contents

Home > @loopback/context > ContextSubscriptionManager > notifyObservers

ContextSubscriptionManager.notifyObservers() method

Publish an event to the registered observers. Please note the notification is queued and performed asynchronously so that we allow fluent APIs such as ctx.bind('key').to(...).tag(...); and give observers the fully populated binding.

Signature:

protected notifyObservers(event: ContextEvent, observers?: Set<ContextEventObserver> | undefined): Promise<void>;

Parameters

Parameter Type Description
event [ContextEvent](/doc/en/lb4/apidocs.context.contextevent.html) Context event
observers Set<[ContextEventObserver](/doc/en/lb4/apidocs.context.contexteventobserver.html)> \| undefined _(Optional)_ Current set of context observers

Returns:

Promise<void>