mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 21:51:40 +00:00
update
This commit is contained in:
42
node_modules/rxjs/_esm2015/scheduler/AsyncScheduler.js
generated
vendored
Normal file
42
node_modules/rxjs/_esm2015/scheduler/AsyncScheduler.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
import { Scheduler } from '../Scheduler';
|
||||
export class AsyncScheduler extends Scheduler {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.actions = [];
|
||||
/**
|
||||
* A flag to indicate whether the Scheduler is currently executing a batch of
|
||||
* queued actions.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.active = false;
|
||||
/**
|
||||
* An internal ID used to track the latest asynchronous task such as those
|
||||
* coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and
|
||||
* others.
|
||||
* @type {any}
|
||||
*/
|
||||
this.scheduled = undefined;
|
||||
}
|
||||
flush(action) {
|
||||
const { actions } = this;
|
||||
if (this.active) {
|
||||
actions.push(action);
|
||||
return;
|
||||
}
|
||||
let error;
|
||||
this.active = true;
|
||||
do {
|
||||
if (error = action.execute(action.state, action.delay)) {
|
||||
break;
|
||||
}
|
||||
} while (action = actions.shift()); // exhaust the scheduler queue
|
||||
this.active = false;
|
||||
if (error) {
|
||||
while (action = actions.shift()) {
|
||||
action.unsubscribe();
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=AsyncScheduler.js.map
|
Reference in New Issue
Block a user