@docsvision/webclient
Version:
Type definitions for DocsVision WebClient scripts and extensions.
49 lines (48 loc) • 2.51 kB
TypeScript
import { ILegacyRouter } from "@docsvision/webclient/Legacy/ILegacyRouter";
import { ICancelableEvent } from '@docsvision/webclient/System/ICancelableEvent';
import { IRouteHandler } from "@docsvision/webclient/System/IRouteHandler";
import { IRouteInfo } from "@docsvision/webclient/System/IRouteInfo";
import { IRouteTypeMapper } from "@docsvision/webclient/System/IRouteTypeMapper";
import { RouteType } from "@docsvision/webclient/System/RouteType";
import { GenModels } from '@docsvision/webclient/Generated/DocsVision.WebClient.Models';
import { RouteFamilySubtype } from '@docsvision/webclient/System/RouteFamilySubtype';
import { IRouteFamily } from '@docsvision/webclient/System/IRouteFamily';
export interface IRouter {
/**
* Please, don't use it. Really.
*/
readonly dangerouslyUrl: string;
readonly previousUrl: string;
getLastRouteProcessingId(): string;
addHandler<T>(routeType: RouteType, handler: IRouteHandler<T>): any;
removeHandler<T>(routeType: RouteType, handler: IRouteHandler<T>): any;
getHandlers<T>(routeType: RouteType): IRouteHandler<T>[];
addRouteTypeMapper(mapper: IRouteTypeMapper<any>): any;
getCurrentRoute<T>(): IRouteInfo<T>;
setCurrentRoute<T>(info: IRouteInfo<T>): any;
readonly currentRouteInfoChanged: ICancelableEvent<IRouteInfo<any>>;
readonly currentProcessingRouteInfo: IRouteInfo<any>;
/**
* Меняет URL без оповещения об этом (т.е. привязанные на адреса обработчики не сработают)
* @param url URL
*/
replaceUrlWithoutNotification(url: string): any;
initialize(): void;
}
export interface IRouterNavigation {
refresh(callback?: Function): Promise<void>;
goTo(route: string, refresh?: boolean, callback?: Function): Promise<void>;
openUrl(url: string, mode: GenModels.OpenMode): Promise<void>;
back(isCancel?: boolean): Promise<void>;
registerRouteFamily(routeFamily: IRouteFamily): any;
getNextRoute(subtype: RouteFamilySubtype): string;
}
export declare type $Router = {
router: IRouter & ILegacyRouter & IRouterNavigation;
};
export declare const $Router: string | ((model?: $Router) => IRouter & ILegacyRouter & IRouterNavigation);
export declare type $RouterNavigation = {
routerNavigation: IRouterNavigation;
};
export declare const $RouterNavigation: string | ((model?: $RouterNavigation) => IRouterNavigation);
export declare const IS_BACK_PARAMETER = "isBackNavigation";