MCPcopy Index your code
hub / github.com/angular/angular / NoopAnimationPlayer

Class NoopAnimationPlayer

packages/animations/src/players/animation_player.ts:124–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23
123 */
124export class NoopAnimationPlayer implements AnimationPlayer {
125 private _onDoneFns: Function[] = [];
126 private _onStartFns: Function[] = [];
127 private _onDestroyFns: Function[] = [];
128 private _originalOnDoneFns: Function[] = [];
129 private _originalOnStartFns: Function[] = [];
130 private _started = false;
131 private _destroyed = false;
132 private _finished = false;
133 private _position = 0;
134 public parentPlayer: AnimationPlayer | null = null;
135 public readonly totalTime: number;
136 constructor(duration: number = 0, delay: number = 0) {
137 this.totalTime = duration + delay;
138 }
139 private _onFinish() {
140 if (!this._finished) {
141 this._finished = true;
142 this._onDoneFns.forEach((fn) => fn());
143 this._onDoneFns = [];
144 }
145 }
146 onStart(fn: () => void): void {
147 this._originalOnStartFns.push(fn);
148 this._onStartFns.push(fn);
149 }
150 onDone(fn: () => void): void {
151 this._originalOnDoneFns.push(fn);
152 this._onDoneFns.push(fn);
153 }
154 onDestroy(fn: () => void): void {
155 this._onDestroyFns.push(fn);
156 }
157 hasStarted(): boolean {
158 return this._started;
159 }
160 init(): void {}
161 play(): void {
162 if (!this.hasStarted()) {
163 this._onStart();
164 this.triggerMicrotask();
165 }
166 this._started = true;
167 }
168
169 /** @internal */
170 triggerMicrotask() {
171 queueMicrotask(() => this._onFinish());
172 }
173
174 private _onStart() {
175 this._onStartFns.forEach((fn) => fn());
176 this._onStartFns = [];
177 }
178
179 pause(): void {}
180 restart(): void {}
181 finish(): void {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…