@virtualstate/app-history
Version:
Native JavaScript [app-history](https://github.com/WICG/app-history) implementation
42 lines (41 loc) • 3.06 kB
TypeScript
import { AppHistory, AppHistoryEntry, AppHistoryEventMap, AppHistoryNavigationOptions, AppHistoryReloadOptions, AppHistoryResult, AppHistoryUpdateCurrentOptions } from "./spec/app-history";
import { EventCallback, EventTargetAddListenerOptions, SyncEventCallback, Event, EventTargetListeners as EventTargetListenersSymbol, EventDescriptor } from "./event-target";
import { AppHistoryNavigateOptions } from "./create-app-history-transition";
export interface AppHistoryAppHistory {
new (thisValue: AppHistory): AppHistoryAppHistory;
}
export declare class AppHistoryAppHistory implements AppHistory {
#private;
[key: string]: unknown;
get [EventTargetListenersSymbol](): EventDescriptor[] | undefined;
constructor(appHistory: AppHistory);
get canGoBack(): boolean;
get canGoForward(): boolean;
get current(): AppHistoryEntry<unknown>;
set oncurrentchange(value: AppHistory["oncurrentchange"]);
set onnavigate(value: AppHistory["onnavigate"]);
set onnavigateerror(value: AppHistory["onnavigateerror"]);
set onnavigatesuccess(value: AppHistory["onnavigatesuccess"]);
get transition(): import("./spec/app-history").AppHistoryTransition;
addEventListener<K extends keyof AppHistoryEventMap>(type: K, listener: (ev: AppHistoryEventMap[K]) => unknown, options?: boolean | EventTargetAddListenerOptions): void;
addEventListener(type: string, listener: EventCallback, options?: boolean | EventTargetAddListenerOptions): void;
addEventListener(type: string | symbol, callback: EventCallback, options?: EventTargetAddListenerOptions): void;
addEventListener(type: string, callback: EventCallback, options?: EventTargetAddListenerOptions): void;
addEventListener(type: string | symbol, callback: Function, options?: EventTargetAddListenerOptions): void;
back(options?: AppHistoryNavigationOptions): AppHistoryResult;
dispatchEvent(event: Event): Promise<void>;
dispatchEvent(event: Event): void;
entries(): AppHistoryEntry[];
forward(options?: AppHistoryNavigationOptions): AppHistoryResult;
goTo(key: string, options?: AppHistoryNavigationOptions): AppHistoryResult;
hasEventListener(type: string | symbol, callback?: Function): boolean;
hasEventListener(type: string, callback?: Function): boolean;
navigate(url: string, options?: AppHistoryNavigateOptions): AppHistoryResult;
reload(options?: AppHistoryReloadOptions): AppHistoryResult;
removeEventListener<K extends keyof AppHistoryEventMap>(type: K, listener: (ev: AppHistoryEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventCallback, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string | symbol, callback: Function, options?: unknown): void;
removeEventListener(type: string, callback: SyncEventCallback<Event>, options?: unknown): void;
updateCurrent(options: AppHistoryUpdateCurrentOptions): Promise<void>;
updateCurrent(options: AppHistoryUpdateCurrentOptions): void;
}