UNPKG

@loopback/docs

Version:
37 lines (24 loc) 1.42 kB
--- lang: en title: 'API docs: context.context.notifyobservers' keywords: LoopBack 4.0, LoopBack 4 sidebar: lb4_sidebar permalink: /doc/en/lb4/apidocs.context.context.notifyobservers.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Context](./context.context.md) &gt; [notifyObservers](./context.context.notifyobservers.md) ## Context.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. <b>Signature:</b> ```typescript protected notifyObservers(eventType: ContextEventType, binding: Readonly<Binding<unknown>>, context: Context, observers?: Set<ContextEventObserver> | undefined): Promise<void>; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | eventType | <code>ContextEventType</code> | Event names: <code>bind</code> or <code>unbind</code> | | binding | <code>Readonly&lt;Binding&lt;unknown&gt;&gt;</code> | Binding bound or unbound | | context | <code>Context</code> | Owner context | | observers | <code>Set&lt;ContextEventObserver&gt; &#124; undefined</code> | Current set of context observers | <b>Returns:</b> `Promise<void>`