Page Contents
Home > @loopback/context > ResolutionSession
ResolutionSession class
Object to keep states for a session to resolve bindings and their dependencies within a context
Signature:
export declare class ResolutionSession
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
bindingStack | readonly |
Readonly<Binding>[] | Getter for bindings on the stack |
currentBinding | readonly |
Readonly<Binding> | undefined | Getter for the current binding |
currentInjection | readonly |
Readonly<Injection> | undefined | Getter for the current injection |
injectionStack | readonly |
Readonly<Injection>[] | Getter for injections on the stack |
stack | readonly |
ResolutionElement[] | A stack of bindings for the current resolution session. It’s used to track the path of dependency resolution and detect circular dependencies. |
Methods
Method | Modifiers | Description |
---|---|---|
describeInjection(injection) | static |
Describe the injection for debugging purpose |
fork(session) | static |
Fork the current session so that a new one with the same stack can be used in parallel or future resolutions, such as multiple method arguments, multiple properties, or a getter function |
getBindingPath() | Get the binding path as bindingA --> bindingB --> bindingC . |
|
getInjectionPath() | Get the injection path as injectionA --> injectionB --> injectionC . |
|
getResolutionPath() | Get the resolution path including bindings and injections, for example: bindingA --> @ClassA[0] --> bindingB --> @ClassB.prototype.prop1 --> bindingC . |
|
popBinding() | Exit the resolution of a binding | |
popInjection() | Pop the last injection | |
pushBinding(binding) | Enter the resolution of the given binding. If | |
pushInjection(injection) | Push the injection onto the session | |
runWithBinding(action, binding, session) | static |
Run the given action with the given binding and session |
runWithInjection(action, injection, session) | static |
Run the given action with the given injection and session |
toString() |