AlphaAlphaLook up the current value of a context key.
The context id. Must be one of the keys the scope's
consumer declared upfront (e.g. a primitive's reads), or any
ContextMap key when the scope is used through the wide
default.
The value if any provider answered, otherwise undefined.
A host-bound, typed view over ContextMap. Resolves each key its own way: by walking the DOM, by consulting a session-wide default, or by reading from a fixed value bag. The caller picks which strategy when they build the scope with ContextRegistry.scope.
One method,
get(key). A consumer that needs more than one key callsgetmultiple times.Each key resolves in order from most specific to least: a per-call override on ContextRegistry.scope wins first, then the closest DOM ancestor that registered a value through ContextRegistry.provide, then a session-wide default registered through ContextRegistry.register. If none of those answer,
getreturnsundefined.Resolution is pull-based, not reactive: a
ContextScopeanswers the current value on eachgetcall but does not notify when a value changes. Re-evaluating against a scope when its inputs change is the caller's responsibility. For reactive consumption of context values, use ContextRegistry.subscribe directly.Rules are one consumer of this contract, but not the only one. Command guards, filter predicates, and any other code that wants a "bind a host plus overrides once, then read keys repeatedly" helper builds a
ContextScopeand reads from it.Example
Building and reading from a scope
See
ContextScope.