Skip to content

Commit ba5624b

Browse files
committed
fix(platform): fire cordova platform.ready using zone
Closes #6186
1 parent 2f342d6 commit ba5624b

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ionic/config/bootstrap.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ export function ionicProviders(args: any = {}) {
6969
export function postBootstrap(appRef: ComponentRef, prodMode: boolean) {
7070
appRef.injector.get(TapClick);
7171
let app: IonicApp = appRef.injector.get(IonicApp);
72-
let platform = appRef.injector.get(Platform);
73-
let zone = appRef.injector.get(NgZone);
74-
platform.prepareReady(zone);
72+
let platform: Platform = appRef.injector.get(Platform);
73+
platform.setZone(appRef.injector.get(NgZone));
74+
platform.prepareReady();
7575
app.setProd(prodMode);
7676
}
7777

ionic/platform/platform.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export class Platform {
4848
this._readyPromise = new Promise(res => { this._readyResolve = res; } );
4949
}
5050

51+
/**
52+
* @private
53+
*/
54+
setZone(zone: NgZone) {
55+
this._zone = zone;
56+
}
57+
5158

5259
// Methods
5360
// **********************************************
@@ -207,11 +214,10 @@ export class Platform {
207214
/**
208215
* @private
209216
*/
210-
prepareReady(zone: NgZone) {
217+
prepareReady() {
211218
// this is the default prepareReady if it's not replaced by the engine
212219
// if there was no custom ready method from the engine
213220
// then use the default DOM ready
214-
this._zone = zone;
215221
ready(this.triggerReady.bind(this));
216222
}
217223

ionic/platform/registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Platform.register({
106106
swipeBackEnabled: isIOSDevice,
107107
swipeBackThreshold: 40,
108108
tapPolyfill: isIOSDevice,
109-
virtualScrollEventAssist: !(window.indexedDB)
109+
virtualScrollEventAssist: !(win.indexedDB)
110110
},
111111
isMatch(p: Platform): boolean {
112112
return p.isPlatformMatch('ios', ['iphone', 'ipad', 'ipod'], ['windows phone']);
@@ -172,7 +172,7 @@ Platform.register({
172172
// 1) ionic bootstrapped
173173
windowLoad(function() {
174174
// 2) window onload triggered or completed
175-
doc.addEventListener('deviceready', () => {
175+
doc.addEventListener('deviceready', function() {
176176
// 3) cordova deviceready event triggered
177177

178178
// add cordova listeners to fire platform events

0 commit comments

Comments
 (0)