frontend/.pnpm-store/v3/files/96/0c78dada64f3b3e8376e0eb390f16252845fbc70299f6802cf762fffc29b80194c966241f4bd38c83d8b1cc129b334e76b42f0a9e4c1e319c3dd3fe40fde5d

32 lines
756 B
Plaintext

import { AsyncAction } from './AsyncAction';
import { AsyncScheduler } from './AsyncScheduler';
export class AnimationFrameScheduler extends AsyncScheduler {
public flush(action?: AsyncAction<any>): void {
this.active = true;
this.scheduled = undefined;
const {actions} = this;
let error: any;
let index: number = -1;
let count: number = 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;
}
}
}