UNPKG

@web-atoms/core

Version:
84 lines 3.62 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 type navigateCallback = (url: AtomUri, options?: IPageOptions) => Promise<any>; export type preNavigateCallback = (url: any, viewModelParameters: { [key: string]: any; }, 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; /** * In mobile application, this will not add chrome/navigation headers on the page */ frameLess?: boolean; /** * Set to true if you want to open modal window blocking entire app. */ modal?: boolean; /** Initializer that will be invoked when page/popup/window is created */ onInit?: (view: any) => void; } export declare abstract class NavigationService { readonly app: App; private callbacks; private beforeCallbacks; constructor(app: App); abstract alert(message: string | FormattedString, title?: string): Promise<any>; abstract confirm(message: string | FormattedString, title?: string): Promise<boolean>; /** * This method will open the page, it will not wait for the result * @param pageName node style package url or a class * @param viewModelParameters key value pair that will be injected on ViewModel when created * @param options {@link IPageOptions} */ pushPage(pageName: string | any, viewModelParameters?: INameValuePairs, options?: IPageOptions): void; /** * This method will open the page and it will wait for result, use pushPage to * ignore the result * @param pageName node style package url or a class * @param viewModelParameters key value pair that will be injected on ViewModel when created * @param options {@link IPageOptions} */ openPage<T>(pageName: string | any, viewModelParameters?: INameValuePairs, options?: IPageOptions): Promise<T>; abstract notify(message: string | FormattedString, title?: string, type?: NotifyType, delay?: number): Promise<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; registerPreNavigationHook(callback: preNavigateCallback): IDisposable; protected abstract openWindow<T>(url: AtomUri, options: IPageOptions): Promise<T>; } //# sourceMappingURL=NavigationService.d.ts.map