UNPKG

2.3 kBTypeScriptView Raw
1/// <reference types="node" />
2import { PlatformLocation } from '@angular/common';
3import * as nodeUrl from 'url';
4export interface LocationConfig {
5 pathname?: string;
6 search?: string;
7 hash?: string;
8}
9export interface NodeLocationConfig {
10 hash?: string;
11 host?: string;
12 hostname?: string;
13 href?: string;
14 pathname?: string;
15 port?: string;
16 protocol?: string;
17 search?: string;
18}
19export declare class NodeLocation implements LocationConfig {
20 hash: string;
21 host: string;
22 hostname: string;
23 href: string;
24 pathname: string;
25 port: string;
26 protocol: string;
27 search: string;
28 readonly origin: string;
29 constructor(config: NodeLocationConfig & LocationConfig);
30 parse(url: string): nodeUrl.Url;
31 format(obj: NodeLocationConfig): string;
32 assign(parsed: NodeLocationConfig): this;
33 toJSON(): NodeLocationConfig;
34}
35export declare class State {
36 state: any;
37 title: string;
38 url: string;
39 constructor(state: any, title: string, url: string);
40 toJSON(): {
41 state: any;
42 title: string;
43 url: string;
44 };
45}
46export declare class PopStateEvent {
47 state: any;
48 type: string;
49 constructor(state: any);
50 toJSON(): {
51 state: any;
52 };
53}
54export declare class NodePlatformLocation extends PlatformLocation {
55 private _loc;
56 private _stack;
57 private _stackIndex;
58 private _popStateListeners;
59 private _baseUrl;
60 private _originUrl;
61 constructor(originUrl: string, requestUrl: string, baseUrl?: string);
62 updateUrl(originUrl: any, baseUrl?: string): void;
63 readonly search: string;
64 readonly hash: string;
65 pathname: string;
66 getBaseHrefFromDOM(): string;
67 getBaseHref(): string;
68 path(): string;
69 pushState(state: any, title: string, url: string): void;
70 replaceState(state: any, title: string, url: string): void;
71 onPopState(fn: any): void;
72 onHashChange(_fn: any): void;
73 back(): void;
74 forward(): void;
75 prepareExternalUrl(internal: string): string;
76 toJSON(): any;
77 private _updateLocation();
78 private _setLocationByUrl(url);
79 private _callPopStateListeners();
80}
81export declare function joinWithSlash(start: string, end: string): string;
82export declare const NODE_LOCATION_PROVIDERS: Array<any>;