You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
783 B
25 lines
783 B
2 years ago
|
import { AsyncScheduler } from './AsyncScheduler';
|
||
|
export class AsapScheduler extends AsyncScheduler {
|
||
|
flush(action) {
|
||
|
this.active = true;
|
||
|
this.scheduled = undefined;
|
||
|
const { actions } = this;
|
||
|
let error;
|
||
|
let index = -1;
|
||
|
let count = actions.length;
|
||
|
action = action || actions.shift();
|
||
|
do {
|
||
|
if (error = action.execute(action.state, action.delay)) {
|
||
|
break;
|
||
|
}
|
||
|
} while (++index < count && (action = actions.shift()));
|
||
|
this.active = false;
|
||
|
if (error) {
|
||
|
while (++index < count && (action = actions.shift())) {
|
||
|
action.unsubscribe();
|
||
|
}
|
||
|
throw error;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
//# sourceMappingURL=AsapScheduler.js.map
|