MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / Context

Class Context

packages/context/src/context.ts:53–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 * Context provides an implementation of Inversion of Control (IoC) container
52 */
53export class Context extends EventEmitter {
54 /**
55 * Name of the context
56 */
57 readonly name: string;
58
59 /**
60 * Key to binding map as the internal registry
61 */
62 protected readonly registry: Map<string, Binding> = new Map();
63
64 /**
65 * Indexer for bindings by tag
66 */
67 protected readonly tagIndexer: ContextTagIndexer;
68
69 /**
70 * Manager for observer subscriptions
71 */
72 readonly subscriptionManager: ContextSubscriptionManager;
73
74 /**
75 * Parent context
76 */
77 protected _parent?: Context;
78
79 /**
80 * Configuration resolver
81 */
82 protected configResolver: ConfigurationResolver;
83
84 /**
85 * A debug function which can be overridden by subclasses.
86 *
87 * @example
88 * ```ts
89 * import debugFactory from 'debug';
90 * const debug = debugFactory('loopback:context:application');
91 * export class Application extends Context {
92 * super('application');
93 * this._debug = debug;
94 * }
95 * ```
96 */
97 protected _debug: Debugger;
98
99 /**
100 * Scope for binding resolution
101 */
102 scope: BindingScope = BindingScope.CONTEXT;
103
104 /**
105 * Create a new context.
106 *
107 * @example
108 * ```ts
109 * // Create a new root context, let the framework to create a unique name
110 * const rootCtx = new Context();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected