refactor(animations): introduce @angular/animation module (#14351)
PR Close: #14351
This commit is contained in:

committed by
Miško Hevery

parent
baa654a234
commit
96073e51c3
@ -17,6 +17,7 @@ import {DomAnimatePlayer} from './dom_animate_player';
|
||||
export class WebAnimationsPlayer implements AnimationPlayer {
|
||||
private _onDoneFns: Function[] = [];
|
||||
private _onStartFns: Function[] = [];
|
||||
private _onDestroyFns: Function[] = [];
|
||||
private _player: DomAnimatePlayer;
|
||||
private _duration: number;
|
||||
private _initialized = false;
|
||||
@ -107,6 +108,8 @@ export class WebAnimationsPlayer implements AnimationPlayer {
|
||||
|
||||
onDone(fn: () => void): void { this._onDoneFns.push(fn); }
|
||||
|
||||
onDestroy(fn: () => void): void { this._onDestroyFns.push(fn); }
|
||||
|
||||
play(): void {
|
||||
this.init();
|
||||
if (!this.hasStarted()) {
|
||||
@ -153,6 +156,8 @@ export class WebAnimationsPlayer implements AnimationPlayer {
|
||||
this._resetDomPlayerState();
|
||||
this._onFinish();
|
||||
this._destroyed = true;
|
||||
this._onDestroyFns.forEach(fn => fn());
|
||||
this._onDestroyFns = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user