mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
Fix some angular (#16615)
* fix(angular): platform types fixes #16535 * fix(angular): memory leak in lifecycle events fixes #16285 * fix ci * single core
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import { EventEmitter, Injectable } from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BackButtonDetail, Platforms, getPlatforms, isPlatform } from '@ionic/core';
|
||||
import { proxyEvent } from '../util/util';
|
||||
import { Subject, Subscription } from 'rxjs';
|
||||
|
||||
|
||||
export interface BackButtonEmitter extends EventEmitter<BackButtonDetail> {
|
||||
subscribeWithPriority(priority: number, callback: () => Promise<any> | void): void;
|
||||
export interface BackButtonEmitter extends Subject<BackButtonDetail> {
|
||||
subscribeWithPriority(priority: number, callback: () => Promise<any> | void): Subscription;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@ -15,7 +16,7 @@ export class Platform {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
backButton: BackButtonEmitter = new EventEmitter<BackButtonDetail>() as any;
|
||||
backButton: BackButtonEmitter = new Subject<BackButtonDetail>() as any;
|
||||
|
||||
/**
|
||||
* The pause event emits when the native platform puts the application
|
||||
@ -23,25 +24,25 @@ export class Platform {
|
||||
* 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 = new EventEmitter<void>();
|
||||
pause = new Subject<void>();
|
||||
|
||||
/**
|
||||
* 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 = new EventEmitter<void>();
|
||||
resume = new Subject<void>();
|
||||
|
||||
/**
|
||||
* The resize event emits when the browser window has changed dimensions. This
|
||||
* could be from a browser window being physically resized, or from a device
|
||||
* changing orientation.
|
||||
*/
|
||||
resize = new EventEmitter<void>();
|
||||
resize = new Subject<void>();
|
||||
|
||||
constructor() {
|
||||
this.backButton.subscribeWithPriority = function(priority, callback) {
|
||||
return this.subscribe((ev: BackButtonDetail) => {
|
||||
return this.subscribe(ev => {
|
||||
ev.register(priority, callback);
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user