UNPKG

723 BPlain TextView Raw
1// Copyright IBM Corp. and LoopBack contributors 2020. All Rights Reserved.
2// Node module: @loopback/context
3// This file is licensed under the MIT License.
4// License text available at https://opensource.org/licenses/MIT
5
6import {Binding} from './binding';
7import {Context} from './context';
8
9/**
10 * Events emitted by a context
11 */
12export type ContextEvent = {
13 /**
14 * Source context that emits the event
15 */
16 context: Context;
17 /**
18 * Binding that is being added/removed/updated
19 */
20 binding: Readonly<Binding<unknown>>;
21 /**
22 * Event type
23 */
24 type: string; // 'bind' or 'unbind'
25};
26
27/**
28 * Synchronous listener for context events
29 */
30export type ContextEventListener = (event: ContextEvent) => void;