fix(angular): platform.ready() returns type

This commit is contained in:
Manu Mtz.-Almeida
2018-04-27 18:24:06 +02:00
parent 9bee0f0879
commit c0ec02e534

View File

@ -11,7 +11,7 @@ export interface PlatformConfig {
export class Platform { export class Platform {
private _platforms: PlatformConfig[] = []; private _platforms: PlatformConfig[] = [];
private _readyPromise: Promise<any>; private _readyPromise: Promise<string>;
/** /**
* @hidden * @hidden
@ -47,14 +47,14 @@ export class Platform {
proxyEvent(this.backButton, document, 'backbutton'); proxyEvent(this.backButton, document, 'backbutton');
proxyEvent(this.resize, document, 'resize'); proxyEvent(this.resize, document, 'resize');
let readyResolve: Function; let readyResolve: (value: string) => void;
this._readyPromise = new Promise(res => { readyResolve = res; } ); this._readyPromise = new Promise(res => { readyResolve = res; } );
if ((window as any)['cordova']) { if ((window as any)['cordova']) {
window.addEventListener('deviceready', () => { window.addEventListener('deviceready', () => {
readyResolve(); readyResolve('cordova');
}); }, {once: true});
} else { } else {
readyResolve(); readyResolve('dom');
} }
} }
@ -150,7 +150,7 @@ export class Platform {
} }
ready(): Promise<void> { ready(): Promise<string> {
return this._readyPromise; return this._readyPromise;
} }