@@ -9,109 +9,53 @@ import {
99 ElementSchemaRegistry ,
1010 ResourceLoader ,
1111 COMPILER_PROVIDERS ,
12- CompilerConfig ,
1312 platformCoreDynamic
1413} from '@angular/compiler' ;
15- import { CommonModule } from '@angular/common' ;
16- import { Provider } from '@angular/core' ;
17- import { NativeScriptRootRenderer , NativeScriptRenderer } from './renderer' ;
18- import { DetachedLoader } from "./common/detached-loader" ;
19- import { ModalDialogHost , ModalDialogService } from "./directives/dialogs" ;
14+ import { Provider } from '@angular/core' ;
2015import {
2116 Type ,
2217 Injector ,
23- OpaqueToken ,
24- ApplicationModule ,
25- ErrorHandler ,
26- platformCore ,
2718 CompilerOptions ,
2819 COMPILER_OPTIONS ,
29- CompilerFactory ,
30- PLATFORM_INITIALIZER ,
31- Renderer ,
32- RootRenderer ,
33- Sanitizer ,
3420 PlatformRef ,
35- ComponentRef ,
36- NgModule ,
3721 NgModuleFactory ,
3822 NgModuleRef ,
3923 EventEmitter ,
24+ OpaqueToken ,
4025 createPlatformFactory
4126} from '@angular/core' ;
4227import * as application from "application" ;
4328import { topmost , NavigationEntry } from "ui/frame" ;
4429import { Page } from 'ui/page' ;
4530import { rendererLog , rendererError } from "./trace" ;
4631import { TextView } from 'ui/text-view' ;
47- import {
48- defaultPageProvider , defaultFrameProvider , defaultDeviceProvider
49- } from "./platform-providers" ;
50- import { NativeScriptDomAdapter , NativeScriptElementSchemaRegistry , NativeScriptSanitizer
51- } from './dom-adapter' ;
32+
33+ import { NativeScriptElementSchemaRegistry } from './dom-adapter' ;
5234import { FileSystemResourceLoader } from './resource-loader' ;
53- import { NS_DIRECTIVES } from './directives' ;
5435
5536import * as nativescriptIntl from "nativescript-intl" ;
5637global . Intl = nativescriptIntl ;
5738
5839type PlatformFactory = ( extraProviders ?: Provider [ ] ) => PlatformRef ;
5940
41+ export { NativeScriptModule } from "./nativescript.module" ;
42+
6043export interface AppOptions {
6144 bootInExistingPage : boolean ,
6245 cssFile ?: string ;
6346 startPageActionBarHidden ?: boolean ;
6447}
6548
66- @NgModule ( {
67- declarations : [
68- DetachedLoader ,
69- ModalDialogHost ,
70- ...NS_DIRECTIVES ,
71- ] ,
72- providers : [
73- {
74- provide :ErrorHandler ,
75- useFactory : ( ) => {
76- return new ErrorHandler ( true )
77- }
78- } ,
79- defaultFrameProvider ,
80- defaultPageProvider ,
81- defaultDeviceProvider ,
82- NativeScriptRootRenderer ,
83- { provide : RootRenderer , useClass : NativeScriptRootRenderer } ,
84- NativeScriptRenderer ,
85- { provide : Renderer , useClass : NativeScriptRenderer } ,
86- { provide : Sanitizer , useClass : NativeScriptSanitizer } ,
87- ModalDialogService
88- ] ,
89- entryComponents : [
90- DetachedLoader ,
91- ] ,
92- imports : [
93- CommonModule ,
94- ApplicationModule ,
95- ] ,
96- exports : [
97- CommonModule ,
98- ApplicationModule ,
99- DetachedLoader ,
100- ModalDialogHost ,
101- ...NS_DIRECTIVES ,
102- ]
103- } )
104- export class NativeScriptModule {
105- }
106-
10749export const NS_COMPILER_PROVIDERS = [
10850 COMPILER_PROVIDERS ,
10951 {
11052 provide : COMPILER_OPTIONS ,
111- useValue : { providers : [
112- { provide : ResourceLoader , useClass : FileSystemResourceLoader } ,
113- { provide : ElementSchemaRegistry , useClass : NativeScriptElementSchemaRegistry } ,
114- ] } ,
53+ useValue : {
54+ providers : [
55+ { provide : ResourceLoader , useClass : FileSystemResourceLoader } ,
56+ { provide : ElementSchemaRegistry , useClass : NativeScriptElementSchemaRegistry } ,
57+ ]
58+ } ,
11559 multi : true
11660 }
11761] ;
@@ -124,8 +68,6 @@ interface BootstrapParams {
12468 appOptions ?: AppOptions
12569}
12670
127- let bootstrapCache : BootstrapParams ;
128-
12971class NativeScriptPlatformRef extends PlatformRef {
13072 constructor ( private platform : PlatformRef , private appOptions ?: AppOptions ) {
13173 super ( ) ;
@@ -244,7 +186,7 @@ class NativeScriptPlatformRef extends PlatformRef {
244186 }
245187}
246188
247- var _platformNativeScriptDynamic : PlatformFactory = createPlatformFactory (
189+ const _platformNativeScriptDynamic : PlatformFactory = createPlatformFactory (
248190 platformCoreDynamic , 'nativeScriptDynamic' , NS_COMPILER_PROVIDERS ) ;
249191
250192export function platformNativeScriptDynamic ( options ?: AppOptions , extraProviders ?: any [ ] ) : PlatformRef {
0 commit comments