pretur.navigation
Version:
SPA navigation helper using react and redux
43 lines (42 loc) • 1.81 kB
TypeScript
import { Reducible, Action, Dispatch } from 'reducible-node';
import { PageInstance } from './pageInstance';
import { Pages, PageOccurrence } from './pages';
export interface PageReplaceOptions extends PageOccurrence<any> {
toRemoveMutex: string;
}
export interface PageOpenOptions extends PageOccurrence<any> {
insertAfterMutex?: string;
}
export interface PageCloseOptions {
mutex: string;
goto?: string;
}
export declare class Navigator implements Reducible<Navigator> {
readonly identifier: symbol;
private pages;
private instances;
private activePageMutex;
private activeChildren;
constructor(pages: Pages, identifier?: symbol);
readonly all: PageInstance<any, any>[];
readonly roots: PageInstance<any, any>[];
readonly active: PageInstance<any, any> | undefined;
readonly activeMutex: string | undefined;
readonly activeRootMutex: string | undefined;
readonly activeRoot: PageInstance<any, any> | undefined;
readonly activeRootIndex: number;
readonly indexAsChildOfActiveRoot: number;
hasChildren(mutex: string): boolean;
childrenOf(mutex: string): PageInstance<any, any>[];
pageFromMutex(mutex: string | undefined): PageInstance<any, any> | undefined;
getActiveChild(mutex: string | undefined): string | undefined;
private persistInstances(instances);
private persistActivePage(instances, mutex);
reduce(action: Action<any>): this;
transit(dispatch: Dispatch, mutex: string | undefined): void;
open(dispatch: Dispatch, occurrence: PageOpenOptions): void;
replace(dispatch: Dispatch, toRemoveMutex: string, occurrence: PageOccurrence<any>): void;
close(dispatch: Dispatch, mutex: string, goto?: string): void;
load(dispatch: Dispatch): void;
clear(dispatch: Dispatch): void;
}