-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathns-platform-location.ts
55 lines (45 loc) · 1.48 KB
/
ns-platform-location.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { NSLocationStrategy } from "./ns-location-strategy";
import { PlatformLocation, LocationChangeListener } from "@angular/common";
import { Injectable } from "@angular/core";
import { routerLog, isLogEnabled } from "../trace";
@Injectable()
export class NativescriptPlatformLocation extends PlatformLocation {
constructor(private locationStrategy: NSLocationStrategy) {
super();
if (isLogEnabled()) {
routerLog("NativescriptPlatformLocation.constructor()");
}
}
getBaseHrefFromDOM(): string {
return "/";
}
onPopState(fn: LocationChangeListener): void {
this.locationStrategy.onPopState(fn);
}
onHashChange(_fn: LocationChangeListener): void {
}
get search(): string {
return "";
}
get hash(): string {
return "";
}
get pathname(): string {
return this.locationStrategy.path();
}
set pathname(_newPath: string) {
throw new Error("NativescriptPlatformLocation set pathname - not implemented");
}
pushState(state: any, title: string, url: string): void {
this.locationStrategy.pushState(state, title, url, null);
}
replaceState(state: any, title: string, url: string): void {
this.locationStrategy.replaceState(state, title, url, null);
}
forward(): void {
throw new Error("NativescriptPlatformLocation.forward() - not implemented");
}
back(): void {
this.locationStrategy.back();
}
}