Skip to content

Commit

Permalink
feat(QueueScheduler): rename ImmediateScheduler to QueueScheduler
Browse files Browse the repository at this point in the history
- rename ImmediateScheduler to QueueScheduler
- rename ImmediateAction to QueueAction
- rename Rx.Scheduler.immediate to Rx.Scheduler.queue

BREAKING CHANGE: Immediate scheduler is now Queue scheduler
related #838
  • Loading branch information
benlesh committed Dec 8, 2015
1 parent b7672f4 commit 66eb537
Show file tree
Hide file tree
Showing 36 changed files with 93 additions and 95 deletions.
2 changes: 1 addition & 1 deletion spec/observables/IteratorObservable-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('IteratorObservable', function () {
[10, 20, 30, 40],
function (x) { return x; },
null,
Rx.Scheduler.immediate
Rx.Scheduler.queue
);

var subscriber = Rx.Subscriber.create(
Expand Down
8 changes: 4 additions & 4 deletions spec/observables/combineLatest-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, hot, cold, expectObservable, expectSubscriptions */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.combineLatest', function () {
it('should combineLatest the provided observables', function () {
Expand All @@ -17,11 +17,11 @@ describe('Observable.combineLatest', function () {
});

it('should combine an immediately-scheduled source with an immediately-scheduled second', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [[1, 4], [2, 4], [2, 5], [3, 5], [3, 6], [3, 7], [3, 8]];
var i = 0;
Observable.combineLatest(a, b, immediateScheduler).subscribe(function (vals) {
Observable.combineLatest(a, b, queueScheduler).subscribe(function (vals) {
expect(vals).toDeepEqual(r[i++]);
}, null, function () {
expect(i).toEqual(r.length);
Expand Down
8 changes: 4 additions & 4 deletions spec/observables/concat-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, expectObservable, expectSubscriptions, cold */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.concat', function () {
it('should emit elements from multiple sources', function () {
Expand Down Expand Up @@ -315,12 +315,12 @@ describe('Observable.concat', function () {
});

it('should concat an immediately-scheduled source with an immediately-scheduled second', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [1, 2, 3, 4, 5, 6, 7, 8];
var i = 0;

Observable.concat(a, b, immediateScheduler).subscribe(function (vals) {
Observable.concat(a, b, queueScheduler).subscribe(function (vals) {
expect(vals).toBe(r[i++]);
}, null, done);
});
Expand Down
1 change: 0 additions & 1 deletion spec/observables/interval-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* globals describe, it, expect, spyOn */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediate = Rx.Scheduler.immediate;
var Observer = Rx.Observer;

describe('Observable.interval', function () {
Expand Down
4 changes: 2 additions & 2 deletions spec/observables/of-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Observable.of', function () {
});

it('should return a scalar observable if only passed one value and a scheduler', function () {
var obs = Observable.of('one', Rx.Scheduler.immediate);
var obs = Observable.of('one', Rx.Scheduler.queue);
expect(obs instanceof ScalarObservable).toBe(true);
});

Expand All @@ -41,7 +41,7 @@ describe('Observable.of', function () {
});

it('should return an empty observable if passed only a scheduler', function () {
var obs = Observable.of(Rx.Scheduler.immediate);
var obs = Observable.of(Rx.Scheduler.queue);
expect(obs instanceof EmptyObservable).toBe(true);
});

Expand Down
1 change: 0 additions & 1 deletion spec/observables/timer-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* globals describe, it, expect, expectObservable, hot, rxTestScheduler */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediate = Rx.Scheduler.immediate;
var Observer = Rx.Observer;

describe('Observable.timer', function () {
Expand Down
6 changes: 3 additions & 3 deletions spec/observables/zip-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold, Symbol */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.zip', function () {
it('should combine a source with a second', function () {
Expand Down Expand Up @@ -562,8 +562,8 @@ describe('Observable.zip', function () {
});

it('should combine an immediately-scheduled source with an immediately-scheduled second', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [[1, 4], [2, 5], [3, 6]];
var i = 0;

Expand Down
8 changes: 4 additions & 4 deletions spec/operators/combineAll-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, hot, cold, expectObservable */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.combineAll()', function () {
it('should work with two nevers', function () {
Expand Down Expand Up @@ -412,11 +412,11 @@ describe('Observable.prototype.combineAll()', function () {
});

it('should combine two immediately-scheduled observables', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [[1, 4], [2, 4], [2, 5], [3, 5], [3, 6], [3, 7], [3, 8]];
var i = 0;
Observable.of(a, b, immediateScheduler).combineAll().subscribe(function (vals) {
Observable.of(a, b, queueScheduler).combineAll().subscribe(function (vals) {
expect(vals).toDeepEqual(r[i++]);
}, null, function () {
expect(i).toEqual(r.length);
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/combineLatest-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, hot, cold, expectObservable, expectSubscriptions */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.combineLatest', function () {
it('should work with two nevers', function () {
Expand Down
14 changes: 7 additions & 7 deletions spec/operators/merge-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, hot, cold, expectObservable, expectSubscriptions, rxTestScheduler */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.merge', function () {
it('should merge a source with a second', function (done) {
Expand All @@ -15,11 +15,11 @@ describe('Observable.prototype.merge', function () {
});

it('should merge an immediately-scheduled source with an immediately-scheduled second', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [1, 2, 4, 3, 5, 6, 7, 8];
var i = 0;
a.merge(b, immediateScheduler).subscribe(function (val) {
a.merge(b, queueScheduler).subscribe(function (val) {
expect(val).toBe(r[i++]);
}, null, done);
});
Expand Down Expand Up @@ -258,11 +258,11 @@ describe('Observable.prototype.mergeAll', function () {
});

it('should merge two immediately-scheduled observables', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [1, 2, 4, 3, 5, 6, 7, 8];
var i = 0;
Observable.of(a, b, immediateScheduler).mergeAll().subscribe(function (val) {
Observable.of(a, b, queueScheduler).mergeAll().subscribe(function (val) {
expect(val).toBe(r[i++]);
}, null, done);
});
Expand Down
8 changes: 4 additions & 4 deletions spec/operators/switch-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var Rx = require('../../dist/cjs/Rx');
var Promise = require('promise');

var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.switch()', function () {
it.asDiagram('switch')('should switch a hot observable of cold observables', function () {
Expand All @@ -16,11 +16,11 @@ describe('Observable.prototype.switch()', function () {
});

it('should switch to each immediately-scheduled inner Observable', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, queueScheduler);
var r = [1, 4, 5, 6];
var i = 0;
Observable.of(a, b, immediateScheduler)
Observable.of(a, b, queueScheduler)
.switch()
.subscribe(function (x) {
expect(x).toBe(r[i++]);
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/switchFirst-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var Rx = require('../../dist/cjs/Rx');
var Promise = require('promise');

var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.switchFirst()', function () {
it('should switch to first immediately-scheduled inner Observable', function () {
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/switchMap-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, hot, cold, expectObservable, expectSubscriptions */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.switchMap()', function () {
it('should switch with a selector function', function (done) {
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/switchMapFirst-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var Rx = require('../../dist/cjs/Rx');
var Promise = require('promise');

var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.switchMapFirst()', function () {
it('should handle outer throw', function () {
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/switchMapTo-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, cold, hot, expectObservable, expectSubscriptions */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.switchMapTo()', function () {
it('should switch a synchronous many outer to a synchronous many inner', function (done) {
Expand Down
6 changes: 3 additions & 3 deletions spec/operators/zip-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('zip', function () {
it('should combine a source with a second', function () {
Expand Down Expand Up @@ -561,8 +561,8 @@ describe('zip', function () {
});

it('should combine an immediately-scheduled source with an immediately-scheduled second', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [[1, 4], [2, 5], [3, 6]];
var i = 0;

Expand Down
12 changes: 6 additions & 6 deletions spec/operators/zipAll-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* globals describe, it, expect, expectSubscriptions, expectObservable */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var immediateScheduler = Rx.Scheduler.immediate;
var queueScheduler = Rx.Scheduler.queue;

describe('Observable.prototype.zipAll', function () {
it('should combine two observables', function () {
Expand Down Expand Up @@ -654,25 +654,25 @@ describe('Observable.prototype.zipAll', function () {
});

it('should combine two immediately-scheduled observables', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var b = Observable.of(4, 5, 6, 7, 8, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8, queueScheduler);
var r = [[1, 4], [2, 5], [3, 6]];
var i = 0;

var result = Observable.of(a, b, immediateScheduler).zipAll();
var result = Observable.of(a, b, queueScheduler).zipAll();

result.subscribe(function (vals) {
expect(vals).toDeepEqual(r[i++]);
}, null, done);
});

it('should combine a source with an immediately-scheduled source', function (done) {
var a = Observable.of(1, 2, 3, immediateScheduler);
var a = Observable.of(1, 2, 3, queueScheduler);
var b = Observable.of(4, 5, 6, 7, 8);
var r = [[1, 4], [2, 5], [3, 6]];
var i = 0;

var result = Observable.of(a, b, immediateScheduler).zipAll();
var result = Observable.of(a, b, queueScheduler).zipAll();

result.subscribe(function (vals) {
expect(vals).toDeepEqual(r[i++]);
Expand Down
10 changes: 5 additions & 5 deletions spec/scheduler-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ var Rx = require('../dist/cjs/Rx');

var Scheduler = Rx.Scheduler;

describe('Scheduler.immediate', function () {
describe('Scheduler.queue', function () {
it('should schedule things recursively', function () {
var call1 = false;
var call2 = false;
Scheduler.immediate.active = false;
Scheduler.immediate.schedule(function () {
Scheduler.queue.active = false;
Scheduler.queue.schedule(function () {
call1 = true;
Scheduler.immediate.schedule(function () {
Scheduler.queue.schedule(function () {
call2 = true;
});
});
Expand All @@ -20,7 +20,7 @@ describe('Scheduler.immediate', function () {

it('should schedule things in the future too', function (done) {
var called = false;
Scheduler.immediate.schedule(function () {
Scheduler.queue.schedule(function () {
called = true;
}, 50);

Expand Down
6 changes: 3 additions & 3 deletions src/Rx.KitchenSink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ import {EmptyError} from './util/EmptyError';
import {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
import {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
import {nextTick} from './scheduler/nextTick';
import {immediate} from './scheduler/immediate';
import {queue} from './scheduler/queue';
import {NextTickScheduler} from './scheduler/NextTickScheduler';
import {ImmediateScheduler} from './scheduler/ImmediateScheduler';
import {QueueScheduler} from './scheduler/QueueScheduler';
import {TimeInterval} from './operator/extended/timeInterval';
import {TestScheduler} from './testing/TestScheduler';
import {VirtualTimeScheduler} from './scheduler/VirtualTimeScheduler';
Expand All @@ -152,7 +152,7 @@ import {rxSubscriber} from './symbol/rxSubscriber';
/* tslint:disable:no-var-keyword */
var Scheduler = {
nextTick,
immediate
queue
};

var Symbol = {
Expand Down
6 changes: 3 additions & 3 deletions src/Rx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ import {Notification} from './Notification';
import {EmptyError} from './util/EmptyError';
import {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
import {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
import {immediate} from './scheduler/immediate';
import {queue} from './scheduler/queue';
import {nextTick} from './scheduler/nextTick';
import {NextTickScheduler} from './scheduler/NextTickScheduler';
import {ImmediateScheduler} from './scheduler/ImmediateScheduler';
import {QueueScheduler} from './scheduler/QueueScheduler';
import {rxSubscriber} from './symbol/rxSubscriber';
/* tslint:enable:no-unused-variable */

/* tslint:disable:no-var-keyword */
var Scheduler = {
nextTick,
immediate
queue
};

var Symbol = {
Expand Down
Loading

0 comments on commit 66eb537

Please sign in to comment.