Skip to content

Commit 4486c1f

Browse files
committed
feat(AsyncScheduler): add AsyncScheduler implementation
1 parent c4f5408 commit 4486c1f

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

src/Rx.DOM.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ import {EmptyError} from './util/EmptyError';
124124
import {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
125125
import {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
126126
import {asap} from './scheduler/asap';
127+
import {async} from './scheduler/async';
127128
import {queue} from './scheduler/queue';
128129
import {animationFrame} from './scheduler/animationFrame';
129130
import {AsapScheduler} from './scheduler/AsapScheduler';
131+
import {AsyncScheduler} from './scheduler/AsyncScheduler';
130132
import {QueueScheduler} from './scheduler/QueueScheduler';
131133
import {AnimationFrameScheduler} from './scheduler/AnimationFrameScheduler';
132134
import {rxSubscriber} from './symbol/rxSubscriber';
@@ -136,6 +138,7 @@ import {AjaxRequest, AjaxResponse, AjaxError, AjaxTimeoutError} from './observab
136138
/* tslint:disable:no-var-keyword */
137139
var Scheduler = {
138140
asap,
141+
async,
139142
queue,
140143
animationFrame
141144
};

src/Rx.KitchenSink.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ import {EmptyError} from './util/EmptyError';
172172
import {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
173173
import {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
174174
import {asap} from './scheduler/asap';
175+
import {async} from './scheduler/async';
175176
import {queue} from './scheduler/queue';
176177
import {AsapScheduler} from './scheduler/AsapScheduler';
178+
import {AsyncScheduler} from './scheduler/AsyncScheduler';
177179
import {QueueScheduler} from './scheduler/QueueScheduler';
178180
import {TimeInterval} from './operator/timeInterval';
179181
import {TestScheduler} from './testing/TestScheduler';
@@ -184,6 +186,7 @@ import {rxSubscriber} from './symbol/rxSubscriber';
184186
/* tslint:disable:no-var-keyword */
185187
var Scheduler = {
186188
asap,
189+
async,
187190
queue
188191
};
189192

src/Rx.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,18 @@ import {EmptyError} from './util/EmptyError';
129129
import {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
130130
import {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
131131
import {asap} from './scheduler/asap';
132+
import {async} from './scheduler/async';
132133
import {queue} from './scheduler/queue';
133134
import {AsapScheduler} from './scheduler/AsapScheduler';
135+
import {AsyncScheduler} from './scheduler/AsyncScheduler';
134136
import {QueueScheduler} from './scheduler/QueueScheduler';
135137
import {rxSubscriber} from './symbol/rxSubscriber';
136138
/* tslint:enable:no-unused-variable */
137139

138140
/* tslint:disable:no-var-keyword */
139141
var Scheduler = {
140142
asap,
143+
async,
141144
queue
142145
};
143146

src/scheduler/AsyncScheduler.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Action} from './Action';
2+
import {FutureAction} from './FutureAction';
3+
import {Subscription} from '../Subscription';
4+
import {QueueScheduler} from './QueueScheduler';
5+
6+
export class AsyncScheduler extends QueueScheduler {
7+
scheduleNow<T>(work: (x?: any) => Subscription, state?: any): Action {
8+
return new FutureAction(this, work).schedule(state, 0);
9+
}
10+
}

src/scheduler/async.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {AsyncScheduler} from './AsyncScheduler';
2+
3+
export const async = new AsyncScheduler();

0 commit comments

Comments
 (0)