Skip to content

Commit cc93366

Browse files
committed
fix(platform): pass original event in EventEmitter
1 parent 7f597a0 commit cc93366

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/platform/platform.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@ export class Platform {
302302
// called by engines (the browser)that do not provide them
303303

304304
/**
305-
* The `exitApp` method is useful when running from a native platform,
306-
* such as Cordova. This adds the ability to place the Cordova app
307-
* in the background.
305+
* @private
308306
*/
309307
exitApp() {}
310308

@@ -321,22 +319,22 @@ export class Platform {
321319
* app's back button within the navbar is clicked, but this event is only
322320
* referencing the platform's hardward back button.
323321
*/
324-
backButton: EventEmitter<any> = new EventEmitter();
322+
backButton: EventEmitter<Event> = new EventEmitter();
325323

326324
/**
327325
* The pause event emits when the native platform puts the application
328326
* into the background, typically when the user switches to a different
329327
* application. This event would emit when a Cordova app is put into
330328
* the background, however, it would not fire on a standard web browser.
331329
*/
332-
pause: EventEmitter<any> = new EventEmitter();
330+
pause: EventEmitter<Event> = new EventEmitter();
333331

334332
/**
335333
* The resume event emits when the native platform pulls the application
336334
* out from the background. This event would emit when a Cordova app comes
337335
* out from the background, however, it would not fire on a standard web browser.
338336
*/
339-
resume: EventEmitter<any> = new EventEmitter();
337+
resume: EventEmitter<Event> = new EventEmitter();
340338

341339

342340
// Getter/Setter Methods

src/platform/registry.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ Platform.register({
176176
// 3) cordova deviceready event triggered
177177

178178
// add cordova listeners to emit platform events
179-
doc.addEventListener('backbutton', function() {
180-
p.backButton.emit(null);
179+
doc.addEventListener('backbutton', function(ev: Event) {
180+
p.backButton.emit(ev);
181181
});
182-
doc.addEventListener('pause', function() {
183-
p.pause.emit(null);
182+
doc.addEventListener('pause', function(ev: Event) {
183+
p.pause.emit(ev);
184184
});
185-
doc.addEventListener('resume', function() {
186-
p.resume.emit(null);
185+
doc.addEventListener('resume', function(ev: Event) {
186+
p.resume.emit(ev);
187187
});
188188

189189
// cordova has its own exitApp method

0 commit comments

Comments
 (0)