mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
run overlay animations outside zone
This commit is contained in:
@ -83,6 +83,14 @@ export class IonicApp {
|
|||||||
this._zone.run(fn);
|
this._zone.run(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
* @param {Function} fn TODO
|
||||||
|
*/
|
||||||
|
zoneRunOutside(fn) {
|
||||||
|
this._zone.runOutsideAngular(fn);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a known component with a key, for easy lookups later.
|
* Register a known component with a key, for easy lookups later.
|
||||||
* @param {TODO} key The key to use to register the component
|
* @param {TODO} key The key to use to register the component
|
||||||
|
@ -75,6 +75,8 @@ export class Overlay {
|
|||||||
|
|
||||||
export class OverlayRef {
|
export class OverlayRef {
|
||||||
constructor(app, overlayType, opts, ref, context) {
|
constructor(app, overlayType, opts, ref, context) {
|
||||||
|
this.app = app;
|
||||||
|
|
||||||
let overlayInstance = (ref && ref.instance);
|
let overlayInstance = (ref && ref.instance);
|
||||||
if (!overlayInstance) return;
|
if (!overlayInstance) return;
|
||||||
|
|
||||||
@ -127,12 +129,21 @@ export class OverlayRef {
|
|||||||
|
|
||||||
ClickBlock(true, animation.duration() + 200);
|
ClickBlock(true, animation.duration() + 200);
|
||||||
|
|
||||||
|
this.app.zoneRunOutside(() => {
|
||||||
|
|
||||||
animation.play().then(() => {
|
animation.play().then(() => {
|
||||||
|
|
||||||
|
this.app.zoneRun(() => {
|
||||||
ClickBlock(false);
|
ClickBlock(false);
|
||||||
animation.dispose();
|
animation.dispose();
|
||||||
instance.viewDidEnter && instance.viewDidEnter();
|
instance.viewDidEnter && instance.viewDidEnter();
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user