lit-ui-router / parentUiViewContext
Variable: parentUiViewContext
ts
const parentUiViewContext: ParentUiViewContext;Defined in: packages/lit-ui-router/src/context.ts:477
The context key every <ui-view> answers for, with itself, so a descendant finds its enclosing view.
A <ui-view> seeks its own parent over the house ui-view-context event; this key is the protocol form of that answer, for everyone else. The nearest enclosing view wins, and no view answers its own request.
Examples
ts
import { consume } from '@lit/context';
import { parentUiViewContext } from 'lit-ui-router/context';
import type { ParentUiView } from 'lit-ui-router/context';
class MyElement extends LitElement {
@consume({ context: parentUiViewContext })
parentView!: ParentUiView;
}ts
import { parentUiViewContext, requestContext } from 'lit-ui-router/context';
const parentView = requestContext(element, parentUiViewContext);