Binder context
The binder context provides the binder instance to all components. This context is provided by the output component.
const BinderContext: ComponentContext<Binder>
Accessor
Section titled “Accessor”import { useBinder } from "@alloy-js/core";
const myContext = useBinder();
Context interface
Section titled “Context interface”findScopeName | (TScope | undefined, string) => Ref<TScope | undefined> | |
findSymbolName | (TScope | undefined, string) => Ref<TSymbol | undefined> | Find a symbol with a given name in the given scope. Returns a ref for the symbol, such that when the symbol is available, the ref value will update. |
getSymbolForRefkey | (Refkey) => Ref<TSymbol | undefined> | |
globalScope | Scope context interface The global scope. This is the root scope for all symbols. | |
nameConflictResolver | optionalNameConflictResolver The name conflict resolver to use for this binder. | |
notifyScopeCreated | (OutputScope) => void | Notifies the binder that a scope has been created. |
notifySymbolCreated | (OutputSymbol) => void | Notifies the binder that a symbol has been created. |
notifySymbolDeleted | (OutputSymbol) => void | Notifies the binder that a symbol has been deleted. |
resolveDeclarationByKey | (TScope | undefined, TScope | undefined, Refkey) => Ref<ResolutionResult<TScope, TSymbol> | undefined> | Resolve the given refkey in the current scope. |
resolveFQN | (string) => Ref<TSymbol | TScope | undefined> | Resolve a fully qualified name to a symbol. Access a nested scope by name
with Per-language packages may provide their own resolveFQN function that uses syntax more natural to that language. |