| 1 |
import { AsyncScheduler } from './AsyncScheduler'; |
| 2 |
export class AnimationFrameScheduler extends AsyncScheduler { |
| 3 |
flush(action) { |
| 4 |
this._active = true; |
| 5 |
let flushId; |
| 6 |
if (action) { |
| 7 |
flushId = action.id; |
| 8 |
} |
| 9 |
else { |
| 10 |
flushId = this._scheduled; |
| 11 |
this._scheduled = undefined; |
| 12 |
} |
| 13 |
const { actions } = this; |
| 14 |
let error; |
| 15 |
action = action || actions.shift(); |
| 16 |
do { |
| 17 |
if ((error = action.execute(action.state, action.delay))) { |
| 18 |
break; |
| 19 |
} |
| 20 |
} while ((action = actions[0]) && action.id === flushId && actions.shift()); |
| 21 |
this._active = false; |
| 22 |
if (error) { |
| 23 |
while ((action = actions[0]) && action.id === flushId && actions.shift()) { |
| 24 |
action.unsubscribe(); |
| 25 |
} |
| 26 |
throw error; |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
//# sourceMappingURL=AnimationFrameScheduler.js.map |