fix(angular): platform ready()

This commit is contained in:
Manu Mtz.-Almeida
2018-04-20 16:08:38 +02:00
parent 4ea8881f33
commit 2b3c14b608
3 changed files with 15 additions and 10 deletions

View File

@ -1,15 +1,24 @@
import { PlatformConfig } from '@ionic/core';
import { HostListener } from '@angular/core';
export class Platform {
private _platforms: PlatformConfig[];
private _platforms: PlatformConfig[] = [];
private _readyPromise: Promise<any>;
private _readyResolve: any;
constructor() {
this._readyPromise = new Promise(res => { this._readyResolve = res; } );
let readyResolve: Function;
this._readyPromise = new Promise(res => { readyResolve = res; } );
if ((window as any)['cordova']) {
window.addEventListener('deviceready', () => {
readyResolve();
});
} else {
readyResolve();
}
}
/**
* @returns {boolean} returns true/false based on platform.
* @description
@ -102,7 +111,7 @@ export class Platform {
}
ready(): Promise<string> {
ready(): Promise<void> {
return this._readyPromise;
}