import { EventEmitter } from 'tsee'; import type { Binding, BindingAddress } from '../bindings'; import { BindingFilter } from '../bindings'; declare type ContextEvents = { add: (bind: Binding) => void; }; export declare class Context extends EventEmitter { name: string; parent?: Context; scope: string; protected readonly registry: Map; constructor(name?: string, parent?: Context); add(bind: Binding): void; find(filter: BindingFilter): Binding[]; /** * Check if a binding exists with the given key in the local context without * delegating to the parent context * @param key - Binding key */ contains(key: BindingAddress): boolean; /** * Check if a key is in the context or its ancestors * @param key - Binding key */ isBound(key: BindingAddress): boolean; /** * Get the context matching the scope * @param scope - Binding scope */ getScopedContext(scope: string): Context | undefined; /** * Check if this context is visible (same or ancestor) to the given one * @param ctx - Another context object */ isVisibleTo(ctx: Context): boolean; /** * Locate the resolution context for the given binding. Bindings in the * resolution context and its ancestors are visible as dependencies to resolve * the given binding * @param binding - Binding object */ getResolutionContext(binding: Binding): Context | undefined; /** * Get the owning context for a binding or its key * @param keyOrBinding - Binding object or key */ getOwnerContext(keyOrBinding: BindingAddress | Binding): Context | undefined; get(key: BindingAddress): Binding | undefined; } export {};