run overlay animations outside zone

This commit is contained in:
Adam Bradley
2015-08-28 16:38:39 -05:00
parent 067179d1cc
commit d94ceaf948
2 changed files with 24 additions and 5 deletions

View File

@ -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

View File

@ -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);
}); });