lit-ui-router / requestRouter
Variable: requestRouter
ts
const requestRouter: (target, options?) => UIRouterLit | undefined;Defined in: packages/lit-ui-router/src/context.ts:212
Requests the router from whichever provider answers on target, and returns the value a provider supplied synchronously.
The target is any EventTarget, not only an element. Returns undefined when nobody answered.
Parameters
| Parameter | Type | Description |
|---|---|---|
target | EventTarget | the event target to dispatch the request from |
options? | RequestRouterOptions | subscription and callback options |
Returns
UIRouterLit | undefined
Example
ts
import { requestRouter } from 'lit-ui-router/context';
class MyElement extends LitElement {
connectedCallback() {
super.connectedCallback();
this.router = requestRouter(this);
}
}