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