mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 21:15:24 +08:00
feat(platform): cordova pause/resume events
This commit is contained in:
@ -290,7 +290,9 @@ export class Platform {
|
|||||||
// called by engines (the browser)that do not provide them
|
// called by engines (the browser)that do not provide them
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* The `exitApp` method is useful when running from a native platform,
|
||||||
|
* such as Cordova. This adds the ability to place the Cordova app
|
||||||
|
* in the background.
|
||||||
*/
|
*/
|
||||||
exitApp() {}
|
exitApp() {}
|
||||||
|
|
||||||
@ -298,17 +300,29 @@ export class Platform {
|
|||||||
// **********************************************
|
// **********************************************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* The back button event is emitted when the user presses the native
|
||||||
|
* platform's back button, also referred to as the "hardware" back button.
|
||||||
|
* This event is only emitted within Cordova apps running on Android and
|
||||||
|
* Windows platforms. This event is not fired on iOS since iOS doesn't come
|
||||||
|
* with a hardware back button in the same sense an Android or Windows device
|
||||||
|
* does. It's important to note that this event does not emit when the Ionic
|
||||||
|
* app's back button within the navbar is clicked, but this event is only
|
||||||
|
* referencing the platform's hardward back button.
|
||||||
*/
|
*/
|
||||||
backButton: EventEmitter<any> = new EventEmitter();
|
backButton: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* The pause event emits when the native platform puts the application
|
||||||
|
* into the background, typically when the user switches to a different
|
||||||
|
* application. This event would emit when a Cordova app is put into
|
||||||
|
* the background, however, it would not fire on a standard web browser.
|
||||||
*/
|
*/
|
||||||
pause: EventEmitter<any> = new EventEmitter();
|
pause: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* 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, however, it would not fire on a standard web browser.
|
||||||
*/
|
*/
|
||||||
resume: EventEmitter<any> = new EventEmitter();
|
resume: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
|
@ -179,12 +179,12 @@ Platform.register({
|
|||||||
doc.addEventListener('backbutton', function() {
|
doc.addEventListener('backbutton', function() {
|
||||||
p.backButton.emit(null);
|
p.backButton.emit(null);
|
||||||
});
|
});
|
||||||
// doc.addEventListener('pause', function() {
|
doc.addEventListener('pause', function() {
|
||||||
// p.pause.emit(null);
|
p.pause.emit(null);
|
||||||
// });
|
});
|
||||||
// doc.addEventListener('resume', function() {
|
doc.addEventListener('resume', function() {
|
||||||
// p.resume.emit(null);
|
p.resume.emit(null);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// cordova has fully loaded and we've added listeners
|
// cordova has fully loaded and we've added listeners
|
||||||
p.triggerReady();
|
p.triggerReady();
|
||||||
|
Reference in New Issue
Block a user