ContextView provides a view for a given context chain to maintain a live list of matching bindings and their resolved values within the context hierarchy.
This class is the key utility to implement dynamic extensions for extension points. For example, the RestServer can react to
controller bindings even they are added/removed/updated after the application starts.
ContextView is an event emitter that emits the following events: - ‘close’: when the view is closed (stopped observing context events) - ‘refresh’: when the view is refreshed as bindings are added/removed - ‘resolve’: when the cached values are resolved and updated
export declare class ContextView<T = unknown> extends EventEmitter implements ContextObserver
|(constructor)(context, filter, comparator)||Constructs a new instance of the
||Get the list of matched bindings. If they are not cached, it tries to find them from the context.|
|close()||Stop listening events from the context|
|findBindings()||Find matching bindings and refresh the cache|
|observe(event, binding)||Listen on
|open()||Start listening events from the context|
|refresh()||Refresh the view by invalidating its cache|
|resolve(session)||Resolve values for the matching bindings|
|singleValue(session)||Get the single value|
|values(session)||Get the list of resolved values. If they are not cached, it tries to find and resolve them.|