| 156 | } |
| 157 | |
| 158 | class RendererAnimationPlayer implements AnimationPlayer { |
| 159 | public parentPlayer: AnimationPlayer | null = null; |
| 160 | private _started = false; |
| 161 | |
| 162 | constructor( |
| 163 | public id: number, |
| 164 | public element: any, |
| 165 | options: AnimationOptions, |
| 166 | private _renderer: Renderer2, |
| 167 | ) { |
| 168 | this._command('create', options); |
| 169 | } |
| 170 | |
| 171 | private _listen(eventName: string, callback: (event: any) => any): () => void { |
| 172 | return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback); |
| 173 | } |
| 174 | |
| 175 | private _command(command: string, ...args: any[]): void { |
| 176 | issueAnimationCommand(this._renderer, this.element, this.id, command, args); |
| 177 | } |
| 178 | |
| 179 | onDone(fn: () => void): void { |
| 180 | this._listen('done', fn); |
| 181 | } |
| 182 | |
| 183 | onStart(fn: () => void): void { |
| 184 | this._listen('start', fn); |
| 185 | } |
| 186 | |
| 187 | onDestroy(fn: () => void): void { |
| 188 | this._listen('destroy', fn); |
| 189 | } |
| 190 | |
| 191 | init(): void { |
| 192 | this._command('init'); |
| 193 | } |
| 194 | |
| 195 | hasStarted(): boolean { |
| 196 | return this._started; |
| 197 | } |
| 198 | |
| 199 | play(): void { |
| 200 | this._command('play'); |
| 201 | this._started = true; |
| 202 | } |
| 203 | |
| 204 | pause(): void { |
| 205 | this._command('pause'); |
| 206 | } |
| 207 | |
| 208 | restart(): void { |
| 209 | this._command('restart'); |
| 210 | } |
| 211 | |
| 212 | finish(): void { |
| 213 | this._command('finish'); |
| 214 | } |
| 215 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…