UNPKG

web-atoms-core

Version:
61 lines 2.42 kB
import { App } from "../App"; import { AtomUri } from "../core/AtomUri"; import FormattedString from "../core/FormattedString"; import { CancelToken, IDisposable, INameValuePairs } from "../core/types"; export declare enum NotifyType { Information = "info", Warning = "warn", Error = "error" } export declare type navigateCallback = (url: AtomUri, options?: IPageOptions) => Promise<any>; export interface IPageOptions { /** * target is name of a Frame or AtomTabbedPage component * where this window/frame should be loaded. */ target?: string; /** * If set to true, it will clear the history of the frame */ clearHistory?: boolean; /** * If you want to cancel the window/frame, you can remove the window by calling cancel on given CancelToken */ cancelToken?: CancelToken; } export declare abstract class NavigationService { readonly app: App; private callbacks; constructor(app: App); abstract alert(message: string | FormattedString, title?: string): Promise<any>; abstract confirm(message: string | FormattedString, title?: string): Promise<boolean>; /** * * @param pageName url * @param p parameters * @param options {@link IPageOptions} */ openPage<T>(pageName: string | any, p?: INameValuePairs, options?: IPageOptions): Promise<T>; abstract notify(message: string | FormattedString, title?: string, type?: NotifyType, delay?: number): void; abstract get title(): string; abstract set title(v: string); abstract get location(): AtomUri; abstract set location(v: AtomUri); abstract navigate(url: string): void; abstract back(): void; abstract refresh(): void; /** * Sends signal to remove window/popup/frame, it will not immediately remove, because * it will identify whether it can remove or not by displaying cancellation warning. Only * if there is no cancellation warning or user chooses to force close, it will not remove. * @param id id of an element * @returns true if view was removed successfully */ remove(view: { element: any; viewModel: any; }, force?: boolean): Promise<boolean>; registerNavigationHook(callback: navigateCallback): IDisposable; protected abstract openWindow<T>(url: AtomUri, options: IPageOptions): Promise<T>; } //# sourceMappingURL=NavigationService.d.ts.map