1 import { AsyncAction } from './AsyncAction';
2 import { AsyncScheduler } from './AsyncScheduler';
4 export class AsapScheduler extends AsyncScheduler {
5 public flush(action?: AsyncAction<any>): void {
8 this.scheduled = undefined;
10 const {actions} = this;
12 let index: number = -1;
13 let count: number = actions.length;
14 action = action || actions.shift();
17 if (error = action.execute(action.state, action.delay)) {
20 } while (++index < count && (action = actions.shift()));
25 while (++index < count && (action = actions.shift())) {