Skip to content

Commit 9ee0051

Browse files
author
vakrilov
committed
chore(update): Replace OpaqueTokens with InjectionTokens.
1 parent 63b672c commit 9ee0051

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

nativescript-angular/platform-common.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ import {
1818
EventEmitter,
1919
Provider,
2020
Sanitizer,
21-
OpaqueToken
21+
InjectionToken
2222
} from "@angular/core";
2323

24-
// Work around a TS bug requiring an import of OpaqueToken without using it
25-
if ((<any>global).___TS_UNUSED) {
26-
(() => {
27-
return OpaqueToken;
28-
})();
29-
}
30-
3124
import { rendererLog, rendererError } from "./trace";
32-
import { PAGE_FACTORY, PageFactory, defaultPageFactoryProvider, setRootPage } from "./platform-providers";
25+
import {
26+
PAGE_FACTORY,
27+
PageFactory,
28+
defaultPageFactoryProvider,
29+
setRootPage,
30+
PageFactoryOptions
31+
} from "./platform-providers";
3332

3433
import { start, setCssFileName } from "tns-core-modules/application";
3534
import { topmost, NavigationEntry } from "tns-core-modules/ui/frame";
@@ -82,7 +81,7 @@ export class NativeScriptPlatformRef extends PlatformRef {
8281
bootstrapModule<M>(
8382
moduleType: Type<M>,
8483
compilerOptions: CompilerOptions | CompilerOptions[] = []
85-
): Promise<NgModuleRef<M>> {
84+
): Promise<NgModuleRef<M>> {
8685
this._bootstrapper = () => this.platform.bootstrapModule(moduleType, compilerOptions);
8786

8887
this.bootstrapApp();

nativescript-angular/platform-providers.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1+
import { InjectionToken } from "@angular/core";
2+
13
import { topmost, Frame } from "tns-core-modules/ui/frame";
4+
import { View } from "tns-core-modules/ui/core/view";
25
import { Page } from "tns-core-modules/ui/page";
3-
import { OpaqueToken } from "@angular/core";
46
import { device, Device } from "tns-core-modules/platform";
5-
import * as platform from "tns-core-modules/platform";
6-
7-
export const APP_ROOT_VIEW = new OpaqueToken("App Root View");
8-
export const DEVICE = new OpaqueToken("platfrom device");
9-
export const PAGE_FACTORY = new OpaqueToken("page factory");
107

11-
// Work around a TS bug requiring an import of platform.Device without using it
12-
if ((<any>global).___TS_UNUSED) {
13-
(() => {
14-
return platform;
15-
})();
16-
}
8+
export const APP_ROOT_VIEW = new InjectionToken<View>("App Root View");
9+
export const DEVICE = new InjectionToken<Device>("platform device");
10+
export const PAGE_FACTORY = new InjectionToken<PageFactory>("page factory");
1711

1812
let _rootPageRef: WeakRef<Page>;
1913

0 commit comments

Comments
 (0)