fix(core): should check Zone existance when scheduleMicroTask (#20656)

PR Close #20656
This commit is contained in:
JiaLi.Passion
2017-11-28 16:23:24 +09:00
committed by Alex Rickabaugh
parent 7b120b5f73
commit 3a86940ca5
2 changed files with 11 additions and 2 deletions

View File

@ -19,6 +19,7 @@ export class AnimationRendererFactory implements RendererFactory2 {
private _animationCallbacksBuffer: [(e: any) => any, any][] = [];
private _rendererCache = new Map<Renderer2, BaseAnimationRenderer>();
private _cdRecurDepth = 0;
private promise: Promise<any> = Promise.resolve(0);
constructor(
private delegate: RendererFactory2, private engine: AnimationEngine, private _zone: NgZone) {
@ -69,7 +70,8 @@ export class AnimationRendererFactory implements RendererFactory2 {
}
private _scheduleCountTask() {
Zone.current.scheduleMicroTask('incremenet the animation microtask', () => this._microtaskId++);
// always use promise to schedule microtask instead of use Zone
this.promise.then(() => { this._microtaskId++; });
}
/* @internal */