Skip to content

Commit

Permalink
feat(angular): observer based api to override hardware back button
Browse files Browse the repository at this point in the history
fixes #15820
  • Loading branch information
manucorporat committed Oct 2, 2018
1 parent c57a7cc commit 6a5aec8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion angular/src/providers/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { BackButtonDetail, Platforms, getPlatforms, isPlatform } from '@ionic/co
import { proxyEvent } from '../util/util';


export class BackButtonEmitter extends EventEmitter<BackButtonDetail> {
subscribeWithPriority(priority: number, callback: () => Promise<any> | void) {
return this.subscribe((ev: BackButtonDetail) => {
ev.register(priority, callback);
});
}
}

@Injectable()
export class Platform {

Expand All @@ -11,7 +19,7 @@ export class Platform {
/**
* @hidden
*/
backButton = new EventEmitter<BackButtonDetail>();
backButton = new BackButtonEmitter();

/**
* The pause event emits when the native platform puts the application
Expand Down

0 comments on commit 6a5aec8

Please sign in to comment.