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

Commit d14b33c

Browse files
Merge pull request #512 from chicoxyzzy/master
actualize docs + replace deprecated throttleWithSelector operator by debounceWithSelector in tests and filenames
2 parents bb10b50 + cb012bd commit d14b33c

13 files changed

Lines changed: 45 additions & 43 deletions

File tree

Gruntfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ var browsers = [{
291291
'src/core/linq/observable/delaysubscription.js', // delayWithSelector, timer, empty
292292
'src/core/linq/observable/delaywithselector.js',
293293
'src/core/linq/observable/timeoutwithselector.js',
294-
'src/core/linq/observable/throttlewithselector.js',
294+
'src/core/linq/observable/debouncewithselector.js',
295295
'src/core/linq/observable/skiplastwithtime.js',
296296
'src/core/linq/observable/takelastwithtime.js',
297297
'src/core/linq/observable/takelastbufferwithtime.js',
@@ -578,7 +578,7 @@ var browsers = [{
578578
'src/core/linq/observable/delaysubscription.js', // delayWithSelector, timer, empty
579579
'src/core/linq/observable/delaywithselector.js',
580580
'src/core/linq/observable/timeoutwithselector.js',
581-
'src/core/linq/observable/throttlewithselector.js',
581+
'src/core/linq/observable/debouncewithselector.js',
582582
'src/core/linq/observable/skiplastwithtime.js',
583583
'src/core/linq/observable/takelastwithtime.js',
584584
'src/core/linq/observable/takelastbufferwithtime.js',
@@ -1490,7 +1490,7 @@ var browsers = [{
14901490
'src/core/linq/observable/delaysubscription.js', // delayWithSelector, timer, empty
14911491
'src/core/linq/observable/delaywithselector.js',
14921492
'src/core/linq/observable/timeoutwithselector.js',
1493-
'src/core/linq/observable/throttlewithselector.js',
1493+
'src/core/linq/observable/debouncewithselector.js',
14941494
'src/core/linq/observable/skiplastwithtime.js',
14951495
'src/core/linq/observable/takelastwithtime.js',
14961496
'src/core/linq/observable/takelastbufferwithtime.js',

doc/api/core/observable.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ The Observer and Observable interfaces provide a generalized mechanism for push-
209209
- [`doAction`](operators/do.md)
210210
- [`catchException`](operators/catchproto.md)
211211
- [`concatObservable`](operators/concatall.md)
212+
- [`contains`](operators/includes.md)
212213
- [`finallyAction`](operators/finally.md)
213214
- [`mergeObservable`](operators/mergeall.md)
214215
- [`throttle`](operators/debounce.md)
215-
- [`throttleWithSelector`](operators/throttlewithselector.md)
216+
- [`throttleWithSelector`](operators/debouncewithselector.md)

doc/api/core/operators/throttlewithselector.md renamed to doc/api/core/operators/debouncewithselector.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### `Rx.Observable.prototype.debounceWithSelector(durationSelector)` ###
22
### `Rx.Observable.prototype.throttleWithSelector(durationSelector)` **DEPRECATED** ###
3-
[Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable/throttlewithselector.js "View in source")
3+
[Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable/debouncewithselector.js "View in source")
44

55
Ignores values from an observable sequence which are followed by another value within a computed debounced duration.
66

@@ -25,7 +25,7 @@ var source = Rx.Observable.for(
2525
return Rx.Observable.timer(x)
2626
})
2727
.map(function(x, i) { return i; })
28-
.throttleWithSelector(function (x) {
28+
.debounceWithSelector(function (x) {
2929
return Rx.Observable.timer(700);
3030
});
3131

@@ -48,7 +48,7 @@ var subscription = source.subscribe(
4848
### Location
4949

5050
File:
51-
- [`/src/core/linq/observable/throttlewithselector.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable/throttlewithselector.js)
51+
- [`/src/core/linq/observable/debouncewithselector.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable/debouncewithselector.js)
5252

5353
Dist:
5454
- [`rx.all.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.all.js)
@@ -69,4 +69,4 @@ NuGet Packages:
6969
- [`RxJS-Time`](http://www.nuget.org/packages/RxJS-Time/)
7070

7171
Unit Tests:
72-
- [`/tests/observable/throttlewithselector.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/tests/observable/throttlewithselector.js)
72+
- [`/tests/observable/debouncewithselector.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/tests/observable/debouncewithselector.js)

doc/gettingstarted/categories.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ This topic lists all major operators implemented by the [`Observable`](https://g
9999
<td>Time-based operations</td>
100100
<td>
101101
<ol>
102+
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/debounce.md">debounce</a></li>
103+
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/debouncewithselector.md">debounceWithSelector</a></li>
102104
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/delay.md">delay</a></li>
103105
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/interval.md">interval</a></li>
104-
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/throttle.md">throttle</a></li>
105-
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/throwttlewithselector.md">throttleWithSelector</a></li>
106106
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/timeinterval.md">timeInterval</a></li>
107107
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/timer.md">timer</a></li>
108108
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/timeout.md">timeout</a></li>
@@ -140,6 +140,7 @@ This topic lists all major operators implemented by the [`Observable`](https://g
140140
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/findindex.md">findIndex</a></li>
141141
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/first.md">first</a></li>
142142
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/firstordefault.md">firstOrDefault</a></li>
143+
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/includes.md">includes</a></li>
143144
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/last.md">last</a></li>
144145
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/lastordefault.md">lastOrDefault</a></li>
145146
<li><a href="https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/select.md">map</a></li>

doc/gettingstarted/promises.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The following list of operators natively support Promises:
2727
- [`Rx.Observable.startAsync`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/startasync.md)
2828
- [`Rx.Observable.prototype.switch`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/switch.md)
2929
- [`Rx.Observable.prototype.takeUntil`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/takeuntil.md)
30-
- [`Rx.Observable.prototype.throttleWithSelector`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/throttlewithselector.md)
30+
- [`Rx.Observable.prototype.debounceWithSelector`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/debouncewithselector.md)
3131
- [`Rx.Observable.prototype.timeoutWithSelector`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/timeoutwithselector.md)
3232
- [`Rx.Observable.while`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/while.md)
3333
- [`Rx.Observable.prototype.window`](https://github.com/Reactive-Extensions/RxJS/tree/master/doc/api/core/operators/window.md)

doc/libraries/rx.complete.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ NuGet Packages:
170170
- [`takeUntil`](../api/core/operators/rxobservableprototypetakeuntilother)
171171
- [`takeUntilWithTime`](../api/core/operators/rxobservableprototypetakeuntilwithtimeendtime-scheduler)
172172
- [`takeWhile`](../api/core/operators/rxobservableprototypetakewhilepredicate-thisarg)
173-
- [`throttle`](../api/core/operators/rxobservableprototypethrottleduetime-scheduler)
174-
- [`throttleWithSelector`](../api/core/operators/rxobservableprototypethrottlewithselectorthrottleselector)
173+
- [`debounce`](../api/core/operators/rxobservableprototypethrottleduetime-scheduler)
174+
- [`debounceWithSelector`](../api/core/operators/rxobservableprototypedebouncewithselectorthrottleselector)
175175
- [`timeInterval`](../api/core/operators/rxobservableprototypetimeintervalscheduler)
176176
- [`timeout`](../api/core/operators/rxobservableprototypetimeoutduetime-other-scheduler)
177177
- [`timeoutWithSelector`](../api/core/operators/rxobservableprototypetimeoutwithselectorfirsttimeout-timeoutdurationselector-other)

doc/libraries/rx.time.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ NuGet Dependencies:
4040
- [`takeLastBufferWithTime`](../api/core/operators/takelastbufferwithtime.md)
4141
- [`takeLastWithTime`](../api/core/operators/takelastwithtime.md)
4242
- [`throttleFirst`](../api/core/operators/throttlefirst.md)
43-
- [`throttleWithSelector`](../api/core/operators/throttlewithselector.md)
43+
- [`debounceWithSelector`](../api/core/operators/debouncewithselector.md)
4444
- [`throttleWithTimeout`](../api/core/operators/debounce.md)
4545
- [`timeInterval`](../api/core/operators/timeinterval.md)
4646
- [`timeout`](../api/core/operators/timeout.md)
File renamed without changes.
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
QUnit.module('Throttle');
1+
QUnit.module('Debounce');
22

33
var Observable = Rx.Observable,
44
TestScheduler = Rx.TestScheduler,
@@ -7,7 +7,7 @@ var Observable = Rx.Observable,
77
onCompleted = Rx.ReactiveTest.onCompleted,
88
subscribe = Rx.ReactiveTest.subscribe;
99

10-
test('Throttle_TimeSpan_AllPass', function () {
10+
test('Debounce_TimeSpan_AllPass', function () {
1111
var scheduler = new TestScheduler();
1212

1313
var xs = scheduler.createHotObservable(
@@ -20,7 +20,7 @@ test('Throttle_TimeSpan_AllPass', function () {
2020
);
2121

2222
var res = scheduler.startWithCreate(function () {
23-
return xs.throttleWithSelector(function () { return Observable.timer(20, scheduler); });
23+
return xs.debounceWithSelector(function () { return Observable.timer(20, scheduler); });
2424
});
2525

2626
res.messages.assertEqual(
@@ -36,7 +36,7 @@ test('Throttle_TimeSpan_AllPass', function () {
3636
);
3737
});
3838

39-
test('Throttle_TimeSpan_AllPass_ErrorEnd', function () {
39+
test('Debounce_TimeSpan_AllPass_ErrorEnd', function () {
4040
var ex = new Error();
4141

4242
var scheduler = new TestScheduler();
@@ -51,7 +51,7 @@ test('Throttle_TimeSpan_AllPass_ErrorEnd', function () {
5151
);
5252

5353
var res = scheduler.startWithCreate(function () {
54-
return xs.throttleWithSelector(function () { return Observable.timer(20, scheduler); });
54+
return xs.debounceWithSelector(function () { return Observable.timer(20, scheduler); });
5555
});
5656

5757
res.messages.assertEqual(
@@ -67,7 +67,7 @@ test('Throttle_TimeSpan_AllPass_ErrorEnd', function () {
6767
);
6868
});
6969

70-
test('Throttle_TimeSpan_AllDrop', function () {
70+
test('Debounce_TimeSpan_AllDrop', function () {
7171
var scheduler = new TestScheduler();
7272

7373
var xs = scheduler.createHotObservable(
@@ -83,7 +83,7 @@ test('Throttle_TimeSpan_AllDrop', function () {
8383
);
8484

8585
var res = scheduler.startWithCreate(function () {
86-
return xs.throttleWithSelector(function () { return Observable.timer(40, scheduler); });
86+
return xs.debounceWithSelector(function () { return Observable.timer(40, scheduler); });
8787
});
8888

8989
res.messages.assertEqual(
@@ -96,7 +96,7 @@ test('Throttle_TimeSpan_AllDrop', function () {
9696
);
9797
});
9898

99-
test('Throttle_TimeSpan_AllDrop_ErrorEnd', function () {
99+
test('Debounce_TimeSpan_AllDrop_ErrorEnd', function () {
100100
var ex = new Error();
101101

102102
var scheduler = new TestScheduler();
@@ -114,7 +114,7 @@ test('Throttle_TimeSpan_AllDrop_ErrorEnd', function () {
114114
);
115115

116116
var res = scheduler.startWithCreate(function () {
117-
return xs.throttle(40, scheduler)
117+
return xs.debounce(40, scheduler)
118118
});
119119

120120
res.messages.assertEqual(
@@ -126,7 +126,7 @@ test('Throttle_TimeSpan_AllDrop_ErrorEnd', function () {
126126
);
127127
});
128128

129-
test('Throttle_Duration_DelayBehavior', function () {
129+
test('Debounce_Duration_DelayBehavior', function () {
130130
var results, scheduler, xs, ys;
131131
scheduler = new TestScheduler();
132132
xs = scheduler.createHotObservable(
@@ -147,7 +147,7 @@ test('Throttle_Duration_DelayBehavior', function () {
147147
];
148148

149149
results = scheduler.startWithCreate(function () {
150-
return xs.throttleWithSelector((function (x) {
150+
return xs.debounceWithSelector((function (x) {
151151
return ys[x];
152152
}));
153153
});
@@ -168,13 +168,13 @@ test('Throttle_Duration_DelayBehavior', function () {
168168
ys[4].subscriptions.assertEqual(subscribe(400, 400 + 20));
169169
});
170170

171-
test('Throttle_Duration_ThrottleBehavior', function () {
171+
test('Debounce_Duration_DebounceBehavior', function () {
172172
var results, scheduler, xs, ys;
173173
scheduler = new TestScheduler();
174174
xs = scheduler.createHotObservable(onNext(150, -1), onNext(250, 0), onNext(280, 1), onNext(310, 2), onNext(350, 3), onNext(400, 4), onCompleted(550));
175175
ys = [scheduler.createColdObservable(onNext(20, 42), onNext(25, 99)), scheduler.createColdObservable(onNext(40, 42), onNext(45, 99)), scheduler.createColdObservable(onNext(20, 42), onNext(25, 99)), scheduler.createColdObservable(onNext(60, 42), onNext(65, 99)), scheduler.createColdObservable(onNext(20, 42), onNext(25, 99))];
176176
results = scheduler.startWithCreate(function () {
177-
return xs.throttleWithSelector(function (x) {
177+
return xs.debounceWithSelector(function (x) {
178178
return ys[x];
179179
});
180180
});
@@ -187,13 +187,13 @@ test('Throttle_Duration_ThrottleBehavior', function () {
187187
ys[4].subscriptions.assertEqual(subscribe(400, 400 + 20));
188188
});
189189

190-
test('Throttle_Duration_EarlyCompletion', function () {
190+
test('Debounce_Duration_EarlyCompletion', function () {
191191
var results, scheduler, xs, ys;
192192
scheduler = new TestScheduler();
193193
xs = scheduler.createHotObservable(onNext(150, -1), onNext(250, 0), onNext(280, 1), onNext(310, 2), onNext(350, 3), onNext(400, 4), onCompleted(410));
194194
ys = [scheduler.createColdObservable(onNext(20, 42), onNext(25, 99)), scheduler.createColdObservable(onNext(40, 42), onNext(45, 99)), scheduler.createColdObservable(onNext(20, 42), onNext(25, 99)), scheduler.createColdObservable(onNext(60, 42), onNext(65, 99)), scheduler.createColdObservable(onNext(20, 42), onNext(25, 99))];
195195
results = scheduler.startWithCreate(function () {
196-
return xs.throttleWithSelector(function (x) {
196+
return xs.debounceWithSelector(function (x) {
197197
return ys[x];
198198
});
199199
});
@@ -206,13 +206,13 @@ test('Throttle_Duration_EarlyCompletion', function () {
206206
ys[4].subscriptions.assertEqual(subscribe(400, 410));
207207
});
208208

209-
test('Throttle_Duration_InnerError', function () {
209+
test('Debounce_Duration_InnerError', function () {
210210
var ex, results, scheduler, xs;
211211
scheduler = new TestScheduler();
212212
xs = scheduler.createHotObservable(onNext(150, 1), onNext(250, 2), onNext(350, 3), onNext(450, 4), onCompleted(550));
213213
ex = 'ex';
214214
results = scheduler.startWithCreate(function () {
215-
return xs.throttleWithSelector(function (x) {
215+
return xs.debounceWithSelector(function (x) {
216216
if (x < 4) {
217217
return scheduler.createColdObservable(onNext(x * 10, "Ignore"), onNext(x * 10 + 5, "Aargh!"));
218218
} else {
@@ -224,27 +224,27 @@ test('Throttle_Duration_InnerError', function () {
224224
xs.subscriptions.assertEqual(subscribe(200, 490));
225225
});
226226

227-
test('Throttle_Duration_OuterError', function () {
227+
test('Debounce_Duration_OuterError', function () {
228228
var ex, results, scheduler, xs;
229229
ex = 'ex';
230230
scheduler = new TestScheduler();
231231
xs = scheduler.createHotObservable(onNext(150, 1), onNext(250, 2), onNext(350, 3), onNext(450, 4), onError(460, ex));
232232
results = scheduler.startWithCreate(function () {
233-
return xs.throttleWithSelector(function (x) {
233+
return xs.debounceWithSelector(function (x) {
234234
return scheduler.createColdObservable(onNext(x * 10, "Ignore"), onNext(x * 10 + 5, "Aargh!"));
235235
});
236236
});
237237
results.messages.assertEqual(onNext(250 + 2 * 10, 2), onNext(350 + 3 * 10, 3), onError(460, ex));
238238
xs.subscriptions.assertEqual(subscribe(200, 460));
239239
});
240240

241-
test('Throttle_Duration_SelectorThrows', function () {
241+
test('Debounce_Duration_SelectorThrows', function () {
242242
var ex, results, scheduler, xs;
243243
ex = 'ex';
244244
scheduler = new TestScheduler();
245245
xs = scheduler.createHotObservable(onNext(150, 1), onNext(250, 2), onNext(350, 3), onNext(450, 4), onCompleted(550));
246246
results = scheduler.startWithCreate(function () {
247-
return xs.throttleWithSelector(function (x) {
247+
return xs.debounceWithSelector(function (x) {
248248
if (x < 4) {
249249
return scheduler.createColdObservable(onNext(x * 10, "Ignore"), onNext(x * 10 + 5, "Aargh!"));
250250
} else {
@@ -256,25 +256,25 @@ test('Throttle_Duration_SelectorThrows', function () {
256256
xs.subscriptions.assertEqual(subscribe(200, 450));
257257
});
258258

259-
test('Throttle_Duration_InnerDone_DelayBehavior', function () {
259+
test('Debounce_Duration_InnerDone_DelayBehavior', function () {
260260
var results, scheduler, xs;
261261
scheduler = new TestScheduler();
262262
xs = scheduler.createHotObservable(onNext(150, 1), onNext(250, 2), onNext(350, 3), onNext(450, 4), onCompleted(550));
263263
results = scheduler.startWithCreate(function () {
264-
return xs.throttleWithSelector(function (x) {
264+
return xs.debounceWithSelector(function (x) {
265265
return scheduler.createColdObservable(onCompleted(x * 10));
266266
});
267267
});
268268
results.messages.assertEqual(onNext(250 + 2 * 10, 2), onNext(350 + 3 * 10, 3), onNext(450 + 4 * 10, 4), onCompleted(550));
269269
xs.subscriptions.assertEqual(subscribe(200, 550));
270270
});
271271

272-
test('Throttle_Duration_InnerDone_ThrottleBehavior', function () {
272+
test('Debounce_Duration_InnerDone_DebounceBehavior', function () {
273273
var results, scheduler, xs;
274274
scheduler = new TestScheduler();
275275
xs = scheduler.createHotObservable(onNext(150, 1), onNext(250, 2), onNext(280, 3), onNext(300, 4), onNext(400, 5), onNext(410, 6), onCompleted(550));
276276
results = scheduler.startWithCreate(function () {
277-
return xs.throttleWithSelector(function (x) {
277+
return xs.debounceWithSelector(function (x) {
278278
return scheduler.createColdObservable(onCompleted(x * 10));
279279
});
280280
});

tests/rx.all.compat.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
<script src="observable/interval.js"></script>
269269
<script src="observable/delay.js"></script>
270270
<script src="observable/debounce.js"></script>
271-
<script src="observable/throttlewithselector.js"></script>
271+
<script src="observable/debouncewithselector.js"></script>
272272
<script src="observable/bufferwithtime.js"></script>
273273
<script src="observable/windowwithtime.js"></script>
274274
<script src="observable/timeinterval.js"></script>

0 commit comments

Comments
 (0)