Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 209d6ce

Browse files
ridding of globals
1 parent fc3f671 commit 209d6ce

55 files changed

Lines changed: 278 additions & 358 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dist/rx.all.compat.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,16 @@ var isEqual = Rx.internals.isEqual = function (value, other) {
17851785
return new BinaryDisposable(disposable, new LocalClearDisposable(id));
17861786
};
17871787

1788+
function scheduleLongRunning(state, action, disposable) {
1789+
return function () { action(state, disposable); };
1790+
}
1791+
1792+
DefaultScheduler.prototype.scheduleLongRunning = function (state, action) {
1793+
var disposable = disposableCreate(noop);
1794+
scheduleMethod(scheduleLongRunning(state, action, disposable));
1795+
return disposable;
1796+
};
1797+
17881798
return DefaultScheduler;
17891799
}(Scheduler));
17901800

@@ -5392,7 +5402,7 @@ observableProto.zipIterable = function () {
53925402
scheduler = immediateScheduler;
53935403
}
53945404
for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
5395-
return enumerableOf([observableFromArray(args, scheduler), this]).concat();
5405+
return observableConcat.apply(null, [observableFromArray(args, scheduler), this]);
53965406
};
53975407

53985408
var TakeLastObserver = (function (__super__) {
@@ -7962,6 +7972,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
79627972
function PausableObservable(source, pauser) {
79637973
this.source = source;
79647974
this.controller = new Subject();
7975+
this.paused = true;
79657976

79667977
if (pauser && pauser.subscribe) {
79677978
this.pauser = this.controller.merge(pauser);
@@ -7977,7 +7988,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
79777988
subscription = conn.subscribe(o),
79787989
connection = disposableEmpty;
79797990

7980-
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
7991+
var pausable = this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function (b) {
79817992
if (b) {
79827993
connection = conn.connect();
79837994
} else {
@@ -7990,10 +8001,12 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
79908001
};
79918002

79928003
PausableObservable.prototype.pause = function () {
8004+
this.paused = true;
79938005
this.controller.onNext(false);
79948006
};
79958007

79968008
PausableObservable.prototype.resume = function () {
8009+
this.paused = false;
79978010
this.controller.onNext(true);
79988011
};
79998012

@@ -8067,6 +8080,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
80678080
function PausableBufferedObservable(source, pauser) {
80688081
this.source = source;
80698082
this.controller = new Subject();
8083+
this.paused = true;
80708084

80718085
if (pauser && pauser.subscribe) {
80728086
this.pauser = this.controller.merge(pauser);
@@ -8085,7 +8099,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
80858099
var subscription =
80868100
combineLatestSource(
80878101
this.source,
8088-
this.pauser.startWith(false).distinctUntilChanged(),
8102+
this.pauser.startWith(!this.paused).distinctUntilChanged(),
80898103
function (data, shouldFire) {
80908104
return { data: data, shouldFire: shouldFire };
80918105
})
@@ -8118,10 +8132,12 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
81188132
};
81198133

81208134
PausableBufferedObservable.prototype.pause = function () {
8135+
this.paused = true;
81218136
this.controller.onNext(false);
81228137
};
81238138

81248139
PausableBufferedObservable.prototype.resume = function () {
8140+
this.paused = false;
81258141
this.controller.onNext(true);
81268142
};
81278143

@@ -8287,7 +8303,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
82878303
}
82888304

82898305
function scheduleMethod(s, self) {
8290-
self.source.request(1);
8306+
return self.source.request(1);
82918307
}
82928308

82938309
StopAndWaitObservable.prototype._subscribe = function (o) {
@@ -8319,15 +8335,15 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
83198335
};
83208336

83218337
function innerScheduleMethod(s, self) {
8322-
self.observable.source.request(1);
8338+
return self.observable.source.request(1);
83238339
}
83248340

83258341
StopAndWaitObserver.prototype.next = function (value) {
83268342
this.observer.onNext(value);
83278343
this.scheduleDisposable = defaultScheduler.schedule(this, innerScheduleMethod);
83288344
};
83298345

8330-
StopAndWaitObservable.dispose = function () {
8346+
StopAndWaitObserver.dispose = function () {
83318347
this.observer = null;
83328348
if (this.cancel) {
83338349
this.cancel.dispose();
@@ -8364,7 +8380,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
83648380
}
83658381

83668382
function scheduleMethod(s, self) {
8367-
self.source.request(self.windowSize);
8383+
return self.source.request(self.windowSize);
83688384
}
83698385

83708386
WindowedObservable.prototype._subscribe = function (o) {
@@ -8397,7 +8413,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
83978413
};
83988414

83998415
function innerScheduleMethod(s, self) {
8400-
self.observable.source.request(self.observable.windowSize);
8416+
return self.observable.source.request(self.observable.windowSize);
84018417
}
84028418

84038419
WindowedObserver.prototype.next = function (value) {
@@ -8450,7 +8466,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
84508466

84518467
source.subscribe(
84528468
function (x) {
8453-
!dest.write(String(x)) && source.pause();
8469+
!dest.write(x) && source.pause();
84548470
},
84558471
function (err) {
84568472
dest.emit('error', err);

dist/rx.all.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,16 @@ var isEqual = Rx.internals.isEqual = function (value, other) {
14341434
return new BinaryDisposable(disposable, new LocalClearDisposable(id));
14351435
};
14361436

1437+
function scheduleLongRunning(state, action, disposable) {
1438+
return function () { action(state, disposable); };
1439+
}
1440+
1441+
DefaultScheduler.prototype.scheduleLongRunning = function (state, action) {
1442+
var disposable = disposableCreate(noop);
1443+
scheduleMethod(scheduleLongRunning(state, action, disposable));
1444+
return disposable;
1445+
};
1446+
14371447
return DefaultScheduler;
14381448
}(Scheduler));
14391449

@@ -5087,7 +5097,7 @@ observableProto.zipIterable = function () {
50875097
scheduler = immediateScheduler;
50885098
}
50895099
for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
5090-
return enumerableOf([observableFromArray(args, scheduler), this]).concat();
5100+
return observableConcat.apply(null, [observableFromArray(args, scheduler), this]);
50915101
};
50925102

50935103
var TakeLastObserver = (function (__super__) {
@@ -7700,6 +7710,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
77007710
function PausableObservable(source, pauser) {
77017711
this.source = source;
77027712
this.controller = new Subject();
7713+
this.paused = true;
77037714

77047715
if (pauser && pauser.subscribe) {
77057716
this.pauser = this.controller.merge(pauser);
@@ -7715,7 +7726,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
77157726
subscription = conn.subscribe(o),
77167727
connection = disposableEmpty;
77177728

7718-
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
7729+
var pausable = this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function (b) {
77197730
if (b) {
77207731
connection = conn.connect();
77217732
} else {
@@ -7728,10 +7739,12 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
77287739
};
77297740

77307741
PausableObservable.prototype.pause = function () {
7742+
this.paused = true;
77317743
this.controller.onNext(false);
77327744
};
77337745

77347746
PausableObservable.prototype.resume = function () {
7747+
this.paused = false;
77357748
this.controller.onNext(true);
77367749
};
77377750

@@ -7805,6 +7818,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
78057818
function PausableBufferedObservable(source, pauser) {
78067819
this.source = source;
78077820
this.controller = new Subject();
7821+
this.paused = true;
78087822

78097823
if (pauser && pauser.subscribe) {
78107824
this.pauser = this.controller.merge(pauser);
@@ -7823,7 +7837,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
78237837
var subscription =
78247838
combineLatestSource(
78257839
this.source,
7826-
this.pauser.startWith(false).distinctUntilChanged(),
7840+
this.pauser.startWith(!this.paused).distinctUntilChanged(),
78277841
function (data, shouldFire) {
78287842
return { data: data, shouldFire: shouldFire };
78297843
})
@@ -7856,10 +7870,12 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
78567870
};
78577871

78587872
PausableBufferedObservable.prototype.pause = function () {
7873+
this.paused = true;
78597874
this.controller.onNext(false);
78607875
};
78617876

78627877
PausableBufferedObservable.prototype.resume = function () {
7878+
this.paused = false;
78637879
this.controller.onNext(true);
78647880
};
78657881

@@ -8025,7 +8041,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
80258041
}
80268042

80278043
function scheduleMethod(s, self) {
8028-
self.source.request(1);
8044+
return self.source.request(1);
80298045
}
80308046

80318047
StopAndWaitObservable.prototype._subscribe = function (o) {
@@ -8057,15 +8073,15 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
80578073
};
80588074

80598075
function innerScheduleMethod(s, self) {
8060-
self.observable.source.request(1);
8076+
return self.observable.source.request(1);
80618077
}
80628078

80638079
StopAndWaitObserver.prototype.next = function (value) {
80648080
this.observer.onNext(value);
80658081
this.scheduleDisposable = defaultScheduler.schedule(this, innerScheduleMethod);
80668082
};
80678083

8068-
StopAndWaitObservable.dispose = function () {
8084+
StopAndWaitObserver.dispose = function () {
80698085
this.observer = null;
80708086
if (this.cancel) {
80718087
this.cancel.dispose();
@@ -8102,7 +8118,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
81028118
}
81038119

81048120
function scheduleMethod(s, self) {
8105-
self.source.request(self.windowSize);
8121+
return self.source.request(self.windowSize);
81068122
}
81078123

81088124
WindowedObservable.prototype._subscribe = function (o) {
@@ -8135,7 +8151,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
81358151
};
81368152

81378153
function innerScheduleMethod(s, self) {
8138-
self.observable.source.request(self.observable.windowSize);
8154+
return self.observable.source.request(self.observable.windowSize);
81398155
}
81408156

81418157
WindowedObserver.prototype.next = function (value) {
@@ -8188,7 +8204,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) {
81888204

81898205
source.subscribe(
81908206
function (x) {
8191-
!dest.write(String(x)) && source.pause();
8207+
!dest.write(x) && source.pause();
81928208
},
81938209
function (err) {
81948210
dest.emit('error', err);

dist/rx.backpressure.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
function PausableObservable(source, pauser) {
103103
this.source = source;
104104
this.controller = new Subject();
105+
this.paused = true;
105106

106107
if (pauser && pauser.subscribe) {
107108
this.pauser = this.controller.merge(pauser);
@@ -117,7 +118,7 @@
117118
subscription = conn.subscribe(o),
118119
connection = disposableEmpty;
119120

120-
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
121+
var pausable = this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function (b) {
121122
if (b) {
122123
connection = conn.connect();
123124
} else {
@@ -130,10 +131,12 @@
130131
};
131132

132133
PausableObservable.prototype.pause = function () {
134+
this.paused = true;
133135
this.controller.onNext(false);
134136
};
135137

136138
PausableObservable.prototype.resume = function () {
139+
this.paused = false;
137140
this.controller.onNext(true);
138141
};
139142

@@ -207,6 +210,7 @@
207210
function PausableBufferedObservable(source, pauser) {
208211
this.source = source;
209212
this.controller = new Subject();
213+
this.paused = true;
210214

211215
if (pauser && pauser.subscribe) {
212216
this.pauser = this.controller.merge(pauser);
@@ -225,7 +229,7 @@
225229
var subscription =
226230
combineLatestSource(
227231
this.source,
228-
this.pauser.startWith(false).distinctUntilChanged(),
232+
this.pauser.startWith(!this.paused).distinctUntilChanged(),
229233
function (data, shouldFire) {
230234
return { data: data, shouldFire: shouldFire };
231235
})
@@ -258,10 +262,12 @@
258262
};
259263

260264
PausableBufferedObservable.prototype.pause = function () {
265+
this.paused = true;
261266
this.controller.onNext(false);
262267
};
263268

264269
PausableBufferedObservable.prototype.resume = function () {
270+
this.paused = false;
265271
this.controller.onNext(true);
266272
};
267273

@@ -427,7 +433,7 @@
427433
}
428434

429435
function scheduleMethod(s, self) {
430-
self.source.request(1);
436+
return self.source.request(1);
431437
}
432438

433439
StopAndWaitObservable.prototype._subscribe = function (o) {
@@ -459,15 +465,15 @@
459465
};
460466

461467
function innerScheduleMethod(s, self) {
462-
self.observable.source.request(1);
468+
return self.observable.source.request(1);
463469
}
464470

465471
StopAndWaitObserver.prototype.next = function (value) {
466472
this.observer.onNext(value);
467473
this.scheduleDisposable = defaultScheduler.schedule(this, innerScheduleMethod);
468474
};
469475

470-
StopAndWaitObservable.dispose = function () {
476+
StopAndWaitObserver.dispose = function () {
471477
this.observer = null;
472478
if (this.cancel) {
473479
this.cancel.dispose();
@@ -504,7 +510,7 @@
504510
}
505511

506512
function scheduleMethod(s, self) {
507-
self.source.request(self.windowSize);
513+
return self.source.request(self.windowSize);
508514
}
509515

510516
WindowedObservable.prototype._subscribe = function (o) {
@@ -537,7 +543,7 @@
537543
};
538544

539545
function innerScheduleMethod(s, self) {
540-
self.observable.source.request(self.observable.windowSize);
546+
return self.observable.source.request(self.observable.windowSize);
541547
}
542548

543549
WindowedObserver.prototype.next = function (value) {
@@ -590,7 +596,7 @@
590596

591597
source.subscribe(
592598
function (x) {
593-
!dest.write(String(x)) && source.pause();
599+
!dest.write(x) && source.pause();
594600
},
595601
function (err) {
596602
dest.emit('error', err);

0 commit comments

Comments
 (0)