mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 02:31:34 +08:00
feat(angular): observer based api to override hardware back button
fixes #15820
This commit is contained in:
@ -3,6 +3,14 @@ import { BackButtonDetail, Platforms, getPlatforms, isPlatform } from '@ionic/co
|
|||||||
import { proxyEvent } from '../util/util';
|
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()
|
@Injectable()
|
||||||
export class Platform {
|
export class Platform {
|
||||||
|
|
||||||
@ -11,7 +19,7 @@ export class Platform {
|
|||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
backButton = new EventEmitter<BackButtonDetail>();
|
backButton = new BackButtonEmitter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pause event emits when the native platform puts the application
|
* The pause event emits when the native platform puts the application
|
||||||
|
Reference in New Issue
Block a user