Function: useScope()
ts
function useScope<E>(host: E): UseScopeValue;Defined in: src/wirestate-lit/consumption/use-scope.ts:42
Consumes a WireScope from the nearest Lit container context.
Type Parameters
| Type Parameter |
|---|
E extends ReactiveControllerHost & HTMLElement |
Parameters
| Parameter | Type | Description |
|---|---|---|
host | E | Host element. |
Returns
Mutable scope holder.
Remarks
The returned value updates when the nearest provided container changes.
Example
typescript
class MyElement extends LitElement {
private scope: UseScopeValue = useScope(this);
public connectedCallback(): void {
super.connectedCallback();
this.scope.value.emitEvent("UI_READY");
}
}