Page Contents

Home > @loopback/context > Context > notifyObservers

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.


protected notifyObservers(eventType: ContextEventType, binding: Readonly<Binding<unknown>>, context: Context, observers?: Set<ContextEventObserver> | undefined): Promise<void>;


Parameter Type Description
eventType ContextEventType Event names: bind or unbind
binding Readonly<Binding<unknown>> Binding bound or unbound
context Context Owner context
observers Set<ContextEventObserver> | undefined Current set of context observers