contexify
Version:
A TypeScript library providing a powerful dependency injection container with context-based IoC capabilities, inspired by LoopBack's Context system.
27 lines (23 loc) • 529 B
text/typescript
import type { Binding } from '../binding/binding.js';
import type { Context } from './context.js';
/**
* Events emitted by a context
*/
export type ContextEvent = {
/**
* Source context that emits the event
*/
context: Context;
/**
* Binding that is being added/removed/updated
*/
binding: Readonly<Binding<unknown>>;
/**
* Event type
*/
type: string; // 'bind' or 'unbind'
};
/**
* Synchronous listener for context events
*/
export type ContextEventListener = (event: ContextEvent) => void;