Skip to content

Commit

Permalink
fix(platform): pass original event in EventEmitter
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Jun 2, 2016
1 parent 7f597a0 commit cc93366
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/platform/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,7 @@ export class Platform {
// called by engines (the browser)that do not provide them

/**
* 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.
* @private
*/
exitApp() {}

Expand All @@ -321,22 +319,22 @@ export class Platform {
* 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<Event> = new EventEmitter();

/**
* 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<Event> = new EventEmitter();

/**
* 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<Event> = new EventEmitter();


// Getter/Setter Methods
Expand Down
12 changes: 6 additions & 6 deletions src/platform/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ Platform.register({
// 3) cordova deviceready event triggered

// add cordova listeners to emit platform events
doc.addEventListener('backbutton', function() {
p.backButton.emit(null);
doc.addEventListener('backbutton', function(ev: Event) {
p.backButton.emit(ev);
});
doc.addEventListener('pause', function() {
p.pause.emit(null);
doc.addEventListener('pause', function(ev: Event) {
p.pause.emit(ev);
});
doc.addEventListener('resume', function() {
p.resume.emit(null);
doc.addEventListener('resume', function(ev: Event) {
p.resume.emit(ev);
});

// cordova has its own exitApp method
Expand Down

0 comments on commit cc93366

Please sign in to comment.