mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
fix(platform): pass original event in EventEmitter
This commit is contained in:
@ -302,9 +302,7 @@ export class Platform {
|
|||||||
// called by engines (the browser)that do not provide them
|
// called by engines (the browser)that do not provide them
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `exitApp` method is useful when running from a native platform,
|
* @private
|
||||||
* such as Cordova. This adds the ability to place the Cordova app
|
|
||||||
* in the background.
|
|
||||||
*/
|
*/
|
||||||
exitApp() {}
|
exitApp() {}
|
||||||
|
|
||||||
@ -321,7 +319,7 @@ export class Platform {
|
|||||||
* app's back button within the navbar is clicked, but this event is only
|
* app's back button within the navbar is clicked, but this event is only
|
||||||
* referencing the platform's hardward back button.
|
* referencing the platform's hardward back button.
|
||||||
*/
|
*/
|
||||||
backButton: EventEmitter<any> = new EventEmitter();
|
backButton: EventEmitter<Event> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pause event emits when the native platform puts the application
|
* The pause event emits when the native platform puts the application
|
||||||
@ -329,14 +327,14 @@ export class Platform {
|
|||||||
* application. This event would emit when a Cordova app is put into
|
* application. This event would emit when a Cordova app is put into
|
||||||
* the background, however, it would not fire on a standard web browser.
|
* the background, however, it would not fire on a standard web browser.
|
||||||
*/
|
*/
|
||||||
pause: EventEmitter<any> = new EventEmitter();
|
pause: EventEmitter<Event> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resume event emits when the native platform pulls the application
|
* The resume 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. This event would emit when a Cordova app comes
|
||||||
* out from the background, however, it would not fire on a standard web browser.
|
* out from the background, however, it would not fire on a standard web browser.
|
||||||
*/
|
*/
|
||||||
resume: EventEmitter<any> = new EventEmitter();
|
resume: EventEmitter<Event> = new EventEmitter();
|
||||||
|
|
||||||
|
|
||||||
// Getter/Setter Methods
|
// Getter/Setter Methods
|
||||||
|
@ -176,14 +176,14 @@ Platform.register({
|
|||||||
// 3) cordova deviceready event triggered
|
// 3) cordova deviceready event triggered
|
||||||
|
|
||||||
// add cordova listeners to emit platform events
|
// add cordova listeners to emit platform events
|
||||||
doc.addEventListener('backbutton', function() {
|
doc.addEventListener('backbutton', function(ev: Event) {
|
||||||
p.backButton.emit(null);
|
p.backButton.emit(ev);
|
||||||
});
|
});
|
||||||
doc.addEventListener('pause', function() {
|
doc.addEventListener('pause', function(ev: Event) {
|
||||||
p.pause.emit(null);
|
p.pause.emit(ev);
|
||||||
});
|
});
|
||||||
doc.addEventListener('resume', function() {
|
doc.addEventListener('resume', function(ev: Event) {
|
||||||
p.resume.emit(null);
|
p.resume.emit(ev);
|
||||||
});
|
});
|
||||||
|
|
||||||
// cordova has its own exitApp method
|
// cordova has its own exitApp method
|
||||||
|
Reference in New Issue
Block a user