@virtualstate/app-history
Version:
Native JavaScript [app-history](https://github.com/WICG/app-history) implementation
50 lines (49 loc) • 1.75 kB
TypeScript
import { AppHistory, AppHistoryResult } from "./spec/app-history";
export interface AppHistoryLocationOptions {
appHistory: AppHistory;
initialUrl?: URL | string;
}
export declare const AppLocationCheckChange: unique symbol;
export declare const AppLocationAwaitFinished: unique symbol;
export declare const AppLocationTransitionURL: unique symbol;
export interface AppHistoryLocation extends Location {
}
/**
* @experimental
*/
export declare class AppHistoryLocation implements Location {
#private;
constructor(options: AppHistoryLocationOptions);
readonly ancestorOrigins: DOMStringList;
get hash(): string;
set hash(value: string);
get host(): string;
set host(value: string);
get hostname(): string;
set hostname(value: string);
get href(): string;
set href(value: string);
get origin(): string;
get pathname(): string;
set pathname(value: string);
get port(): string;
set port(value: string);
get protocol(): string;
set protocol(value: string);
get search(): string;
set search(value: string);
replace(url: string | URL): Promise<void>;
replace(url: string | URL): void;
reload(): Promise<void>;
reload(): void;
assign(url: string | URL): Promise<void>;
assign(url: string | URL): void;
protected [AppLocationTransitionURL](url: URL | string, fn: (url: URL) => AppHistoryResult): Promise<void>;
protected [AppLocationAwaitFinished](result: AppHistoryResult): Promise<void>;
/**
* This is needed if you have changed searchParams using its mutating methods
*
* TODO replace get searchParams with an observable change to auto trigger this function
*/
[AppLocationCheckChange](): Promise<void>;
}