(props: {
readonly value: Service
readonly children: React.ReactNode
}): React.ReactElementProvide a live Service to descendant skins (used by ../View.compose).
export const const Provider: (props: {
readonly value: Service
readonly children: React.ReactNode
}) => React.ReactElement
Provide a live
Service
to descendant skins (used by
../View.compose
).
Provider = (props: {
readonly value: Service
readonly children: React.ReactNode
}
props: {
readonly value: Service(property) value: {
root: RouteGroup;
mode: "memory" | "history";
path: ReadonlyArray<string>;
trail: ReadonlyArray<RouteGroup>;
group: RouteGroup;
selected: unknown | null;
view: string | undefined;
open: (member: MemberTag) => void;
openKey: (key: string) => void;
back: () => void;
toRoot: () => void;
openLogs: (tag: LeafTag) => void;
openSchedule: (tag: LeafTag) => void;
subscribe: (listener: () => void) => () => void;
syncFromLocation: () => void;
}
value: Service;
readonly children: React.ReactNodechildren: React.type React.ReactNode = string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<AwaitedReactNode> | null | undefinedRepresents all of the things React can render.
Where
ReactElement
only represents JSX, ReactNode represents everything that can be rendered.
ReactNode;
}): React.interface React.ReactElement<P = unknown, T extends string | React.JSXElementConstructor<any> = string | React.JSXElementConstructor<any>>Represents a JSX element.
Where
ReactNode
represents everything that can be rendered, ReactElement
only represents JSX.
ReactElement => {
const { const value: Serviceconst value: {
root: RouteGroup;
mode: "memory" | "history";
path: ReadonlyArray<string>;
trail: ReadonlyArray<RouteGroup>;
group: RouteGroup;
selected: unknown | null;
view: string | undefined;
open: (member: MemberTag) => void;
openKey: (key: string) => void;
back: () => void;
toRoot: () => void;
openLogs: (tag: LeafTag) => void;
openSchedule: (tag: LeafTag) => void;
subscribe: (listener: () => void) => () => void;
syncFromLocation: () => void;
}
value } = props: {
readonly value: Service
readonly children: React.ReactNode
}
props;
React.function React.useEffect(effect: React.EffectCallback, deps?: React.DependencyList): voidAccepts a function that contains imperative, possibly effectful code.
useEffect(() => {
if (const value: Serviceconst value: {
root: RouteGroup;
mode: "memory" | "history";
path: ReadonlyArray<string>;
trail: ReadonlyArray<RouteGroup>;
group: RouteGroup;
selected: unknown | null;
view: string | undefined;
open: (member: MemberTag) => void;
openKey: (key: string) => void;
back: () => void;
toRoot: () => void;
openLogs: (tag: LeafTag) => void;
openSchedule: (tag: LeafTag) => void;
subscribe: (listener: () => void) => () => void;
syncFromLocation: () => void;
}
value.Service.mode: "memory" | "history"mode !== "history" || typeof var window: Window & typeof globalThisThe window property of a Window object points to the window object itself.
window === "undefined") return;
const value: Serviceconst value: {
root: RouteGroup;
mode: "memory" | "history";
path: ReadonlyArray<string>;
trail: ReadonlyArray<RouteGroup>;
group: RouteGroup;
selected: unknown | null;
view: string | undefined;
open: (member: MemberTag) => void;
openKey: (key: string) => void;
back: () => void;
toRoot: () => void;
openLogs: (tag: LeafTag) => void;
openSchedule: (tag: LeafTag) => void;
subscribe: (listener: () => void) => () => void;
syncFromLocation: () => void;
}
value.Service.syncFromLocation: () => voidHistory mode: re-read location.pathname.
syncFromLocation();
const const onPop: () => voidonPop = (): void => const value: Serviceconst value: {
root: RouteGroup;
mode: "memory" | "history";
path: ReadonlyArray<string>;
trail: ReadonlyArray<RouteGroup>;
group: RouteGroup;
selected: unknown | null;
view: string | undefined;
open: (member: MemberTag) => void;
openKey: (key: string) => void;
back: () => void;
toRoot: () => void;
openLogs: (tag: LeafTag) => void;
openSchedule: (tag: LeafTag) => void;
subscribe: (listener: () => void) => () => void;
syncFromLocation: () => void;
}
value.Service.syncFromLocation: () => voidHistory mode: re-read location.pathname.
syncFromLocation();
var window: Window & typeof globalThisThe window property of a Window object points to the window object itself.
window.addEventListener<"popstate">(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, options?: boolean | AddEventListenerOptions): void (+1 overload)The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
addEventListener("popstate", const onPop: () => voidonPop);
return () => var window: Window & typeof globalThisThe window property of a Window object points to the window object itself.
window.removeEventListener<"popstate">(type: "popstate", listener: (this: Window, ev: PopStateEvent) => any, options?: boolean | EventListenerOptions): void (+1 overload)The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
removeEventListener("popstate", const onPop: () => voidonPop);
}, [const value: Serviceconst value: {
root: RouteGroup;
mode: "memory" | "history";
path: ReadonlyArray<string>;
trail: ReadonlyArray<RouteGroup>;
group: RouteGroup;
selected: unknown | null;
view: string | undefined;
open: (member: MemberTag) => void;
openKey: (key: string) => void;
back: () => void;
toRoot: () => void;
openLogs: (tag: LeafTag) => void;
openSchedule: (tag: LeafTag) => void;
subscribe: (listener: () => void) => () => void;
syncFromLocation: () => void;
}
value]);
return React.function React.createElement<React.ProviderProps<Service | null>>(type: React.FunctionComponent<React.ProviderProps<Service | null>>, props?: (React.Attributes & React.ProviderProps<Service | null>) | null | undefined, ...children: React.ReactNode[]): React.FunctionComponentElement<React.ProviderProps<Service | null>> (+6 overloads)createElement(
const NavigatorReactContext: React.Context<Service | null>NavigatorReactContext.React.Context<Service | null>.Provider: React.Provider<Service | null>Provider,
{ React.ProviderProps<Service | null>.value: Service(property) React.ProviderProps<Service | null>.value: {
root: RouteGroup;
mode: "memory" | "history";
path: ReadonlyArray<string>;
trail: ReadonlyArray<RouteGroup>;
group: RouteGroup;
selected: unknown | null;
view: string | undefined;
open: (member: MemberTag) => void;
openKey: (key: string) => void;
back: () => void;
toRoot: () => void;
openLogs: (tag: LeafTag) => void;
openSchedule: (tag: LeafTag) => void;
subscribe: (listener: () => void) => () => void;
syncFromLocation: () => void;
}
value },
props: {
readonly value: Service
readonly children: React.ReactNode
}
props.children: React.ReactNodechildren,
);
};