mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
refactor(all): cosmetic changes + app.resize as event emitter
This commit is contained in:
@ -38,7 +38,6 @@ export class Platform {
|
||||
private _ua: string;
|
||||
private _qp = new QueryParams();
|
||||
private _nPlt: string;
|
||||
private _onResizes: Array<Function> = [];
|
||||
private _readyPromise: Promise<any>;
|
||||
private _readyResolve: any;
|
||||
private _bbActions: BackButtonAction[] = [];
|
||||
@ -404,6 +403,13 @@ export class Platform {
|
||||
*/
|
||||
resume: EventEmitter<Event> = new EventEmitter<Event>();
|
||||
|
||||
/**
|
||||
* The resize event emits when the native platform pulls the application
|
||||
* out from the background. This event would emit when a Cordova app comes
|
||||
* out from the background, however, it would not fire on a standard web browser.
|
||||
*/
|
||||
resize: EventEmitter<Event> = new EventEmitter<Event>();
|
||||
|
||||
/**
|
||||
* The back button event is triggered when the user presses the native
|
||||
* platform's back button, also referred to as the "hardware" back button.
|
||||
@ -737,18 +743,6 @@ export class Platform {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
onResize(cb: Function): Function {
|
||||
const self = this;
|
||||
self._onResizes.push(cb);
|
||||
|
||||
return function() {
|
||||
removeArrayItem(self._onResizes, cb);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -812,14 +806,7 @@ export class Platform {
|
||||
if (this.hasFocusedTextInput() === false) {
|
||||
this._isPortrait = null;
|
||||
}
|
||||
|
||||
for (let i = 0; i < this._onResizes.length; i++) {
|
||||
try {
|
||||
this._onResizes[i]();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
this.resize.emit();
|
||||
}, 200);
|
||||
}, { passive: true, zone: true });
|
||||
}, 2000);
|
||||
|
Reference in New Issue
Block a user