@loopback/docs
Version:
Documentation for LoopBack 4
37 lines (24 loc) • 1.42 kB
Markdown
---
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) > [@loopback/context](./context.md) > [Context](./context.context.md) > [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<Binding<unknown>></code> | Binding bound or unbound |
| context | <code>Context</code> | Owner context |
| observers | <code>Set<ContextEventObserver> | undefined</code> | Current set of context observers |
<b>Returns:</b>
`Promise<void>`