source: trip-planner-front/node_modules/rxjs/src/internal/scheduler/AsapScheduler.ts@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 746 bytes
Line 
1import { AsyncAction } from './AsyncAction';
2import { AsyncScheduler } from './AsyncScheduler';
3
4export class AsapScheduler extends AsyncScheduler {
5 public flush(action?: AsyncAction<any>): void {
6
7 this.active = true;
8 this.scheduled = undefined;
9
10 const {actions} = this;
11 let error: any;
12 let index: number = -1;
13 let count: number = actions.length;
14 action = action || actions.shift();
15
16 do {
17 if (error = action.execute(action.state, action.delay)) {
18 break;
19 }
20 } while (++index < count && (action = actions.shift()));
21
22 this.active = false;
23
24 if (error) {
25 while (++index < count && (action = actions.shift())) {
26 action.unsubscribe();
27 }
28 throw error;
29 }
30 }
31}
Note: See TracBrowser for help on using the repository browser.