|
6 | 6 | //profiling.start("application-start");
|
7 | 7 |
|
8 | 8 | // "nativescript-angular/application" import should be first in order to load some required settings (like globals and reflect-metadata)
|
9 |
| -import { |
10 |
| - NativeScriptModule, |
11 |
| - platformNativeScriptDynamic, |
12 |
| - NativeScriptRouterModule, |
13 |
| - NativeScriptFormsModule, |
14 |
| - NativeScriptHttpModule, |
15 |
| - routerTraceCategory, |
16 |
| - rendererTraceCategory, |
17 |
| - listViewTraceCategory, |
18 |
| - PAGE_FACTORY, |
19 |
| - PageFactory, |
20 |
| - PageFactoryOptions, |
21 |
| - onAfterLivesync, |
22 |
| - onBeforeLivesync |
23 |
| -} from "nativescript-angular"; |
| 9 | +import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform"; |
| 10 | +import { onAfterLivesync, onBeforeLivesync } from "nativescript-angular/platform-common"; |
24 | 11 | import { NgModule } from "@angular/core";
|
25 | 12 | import { Router } from "@angular/router";
|
| 13 | +import { NativeScriptRouterModule } from "nativescript-angular/router"; |
| 14 | +import { NativeScriptFormsModule } from "nativescript-angular/forms"; |
| 15 | +import { NativeScriptHttpModule } from "nativescript-angular/http"; |
| 16 | +import { rendererTraceCategory, routerTraceCategory, listViewTraceCategory } from "nativescript-angular/trace"; |
| 17 | +import { PAGE_FACTORY, PageFactory, PageFactoryOptions } from "nativescript-angular/platform-providers"; |
26 | 18 | import { Page } from "ui/page";
|
27 | 19 | import { Color } from "color";
|
28 | 20 | import { setCategories, enable } from "trace";
|
@@ -146,24 +138,24 @@ platformNativeScriptDynamic().bootstrapModule(makeExampleModule(RendererTest));
|
146 | 138 | // platformNativeScriptDynamic().bootstrapModule(makeExampleModule(AnimationEnterLeaveTest));
|
147 | 139 |
|
148 | 140 | //Livesync test
|
149 |
| -//var cachedUrl: string; |
150 |
| -//onBeforeLivesync.subscribe((moduleRef) => { |
151 |
| -// console.log("------- onBeforeLivesync"); |
152 |
| -// if (moduleRef) { |
153 |
| -// const router = <Router>moduleRef.injector.get(Router); |
154 |
| -// cachedUrl = router.url; |
155 |
| -// console.log("------- Caching URL: " + cachedUrl); |
156 |
| -// } |
157 |
| -//}); |
158 |
| -// |
159 |
| -//onAfterLivesync.subscribe((moduleRef) => { |
160 |
| -// console.log("------- onAfterLivesync cachedUrl:"); |
161 |
| -// const router = <Router>moduleRef.injector.get(Router); |
162 |
| -// router.events.subscribe(e => console.log(e.toString())); |
163 |
| -// if (router && cachedUrl) { |
164 |
| -// setTimeout(() => { router.navigateByUrl(cachedUrl); }, 0); |
165 |
| -// } |
166 |
| -//}); |
| 141 | +var cachedUrl: string; |
| 142 | +onBeforeLivesync.subscribe((moduleRef) => { |
| 143 | + console.log("------- onBeforeLivesync"); |
| 144 | + if (moduleRef) { |
| 145 | + const router = <Router>moduleRef.injector.get(Router); |
| 146 | + cachedUrl = router.url; |
| 147 | + console.log("------- Caching URL: " + cachedUrl); |
| 148 | + } |
| 149 | +}); |
| 150 | + |
| 151 | +onAfterLivesync.subscribe((moduleRef) => { |
| 152 | + console.log("------- onAfterLivesync cachedUrl:"); |
| 153 | + const router = <Router>moduleRef.injector.get(Router); |
| 154 | + router.events.subscribe(e => console.log(e.toString())); |
| 155 | + if (router && cachedUrl) { |
| 156 | + setTimeout(() => { router.navigateByUrl(cachedUrl); }, 0); |
| 157 | + } |
| 158 | +}); |
167 | 159 |
|
168 | 160 | //platformNativeScriptDynamic().bootstrapModule(makeExampleModule(LivesyncApp));
|
169 | 161 | console.log("APP RESTART");
|
0 commit comments