rxjs-rails 2.2.14 → 2.2.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c11f2cafb0135d11223fc137900dddac1060c36e
4
- data.tar.gz: 08472b373d3dfd97ac6260df5890f694efbc892d
3
+ metadata.gz: 08f8912e5ff1fe9be57e06ba7535186bb33d166f
4
+ data.tar.gz: 053e4f0cd0222ef7e3b7bef4b0aaedef548020b2
5
5
  SHA512:
6
- metadata.gz: 29107e403bcd749e7962388b11fc6e03e5732dd33f8abd8cf59810e3cbb29a0723417ce6637ebec376f19ec95748cb52777513204db52728214b41958e2d0478
7
- data.tar.gz: 53573da1e17c94cd22a4e13d540719c94cf8609e60afff6ea564925dc935cac84df00adc45255f568caaa8c4044b8c6d10093102227e8659ad454a578803d206
6
+ metadata.gz: 0d5c035e39050e723cac22d48ae265923d840270bc7dfb67f87ba39126b4de8008351a396e72f98a45c6384f389232360bf2bc50af588a3912780e79df8d1f9c
7
+ data.tar.gz: 494f7a3ea7c1338eeb53e1372e102ca9bce2bb5f0f9346dce9b103a6d5e0c0f7b5b0c717b5bf504cdb1a6e56992aec5bfa9b3dc31d2099340ba4487ce510b3a5
data/README.md CHANGED
@@ -12,40 +12,17 @@ Reference the appropriate rx.js file in your application.js eg:
12
12
 
13
13
  `*= require rx.lite`
14
14
 
15
- Available js files:
16
-
17
- rx.aggregates.js
18
- rx.aggregates.min.js
19
- rx.async.compat.js
20
- rx.async.compat.min.js
21
- rx.async.js
22
- rx.async.min.js
23
- rx.binding.js
24
- rx.binding.min.js
25
- rx.coincidence.js
26
- rx.coincidence.min.js
27
- rx.compat.js
28
- rx.compat.min.js
29
- rx.experimental.js
30
- rx.experimental.min.js
31
- rx.joinpatterns.js
32
- rx.joinpatterns.min.js
33
- rx.lite.compat.js
34
- rx.lite.compat.min.js
35
- rx.lite.js
36
- rx.lite.min.js
37
- rx.min.js
38
- rx.node.js
39
- rx.testing.js
40
- rx.testing.min.js
41
- rx.time.js
42
- rx.time.min.js
43
- rx.virtualtime.js
44
- rx.virtualtime.min.js
45
-
46
- ## versions
47
-
48
- ```
49
- Version now mirrors RxJS release
50
- ```
15
+ For available files look in [vendor/assets](https://github.com/jdeseno/rxjs-rails/tree/master/vendor/assets/javascripts)
16
+
17
+ ## Version
18
+
19
+ Version mirrors RxJS release
20
+
21
+ ## License
22
+
23
+ Gem is licensed MIT.
24
+
25
+ Copyright and license for RxJS content is under it's own terms.
26
+ See the [RxJS website](https://github.com/Reactive-Extensions/RxJS#license) for information.
27
+ A copy of the RxJS license is distributed as [rxjs_license.txt](https://github.com/jdeseno/rxjs-rails/tree/master/rxjs_license.txt).
51
28
 
@@ -1,6 +1,6 @@
1
1
  module Rxjs
2
2
  module Rails
3
- VERSION = "2.2.14"
3
+ VERSION = "2.2.15"
4
4
  end
5
5
  end
6
6
 
data/rxjs_license.txt ADDED
@@ -0,0 +1,15 @@
1
+ Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
2
+ Microsoft Open Technologies would like to thank its contributors, a list
3
+ of whom are at http://rx.codeplex.com/wikipage?title=Contributors.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License"); you
6
+ may not use this file except in compliance with the License. You may
7
+ obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ implied. See the License for the specific language governing permissions
15
+ and limitations under the License.
@@ -36,19 +36,19 @@
36
36
  // References
37
37
  var Observable = Rx.Observable,
38
38
  observableProto = Observable.prototype,
39
- AnonymousObservable = Rx.Internals.AnonymousObservable,
39
+ AnonymousObservable = Rx.AnonymousObservable,
40
+ CompositeDisposable = Rx.CompositeDisposable,
40
41
  Subject = Rx.Subject,
41
42
  Observer = Rx.Observer,
42
43
  disposableEmpty = Rx.Disposable.empty,
43
44
  disposableCreate = Rx.Disposable.create,
44
- inherits = Rx.Internals.inherits,
45
- addProperties = Rx.Internals.addProperties,
45
+ inherits = Rx.internals.inherits,
46
+ addProperties = Rx.internals.addProperties,
46
47
  timeoutScheduler = Rx.Scheduler.timeout;
47
48
 
48
49
  var objectDisposed = 'Object has been disposed';
49
- function checkDisposed() {
50
- if (this.isDisposed) { throw new Error(objectDisposed); }
51
- }
50
+ function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
51
+ function identity (x) { return x; }
52
52
 
53
53
  /**
54
54
  * Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
@@ -77,5 +77,258 @@
77
77
  return new CompositeDisposable(subscription, connection, pausable);
78
78
  });
79
79
  };
80
+ function combineLatestSource(source, subject, resultSelector) {
81
+ return new AnonymousObservable(function (observer) {
82
+ var n = 2,
83
+ hasValue = [false, false],
84
+ hasValueAll = false,
85
+ isDone = false,
86
+ values = new Array(n);
87
+
88
+ function next(x, i) {
89
+ values[i] = x
90
+ var res;
91
+ hasValue[i] = true;
92
+ if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
93
+ try {
94
+ res = resultSelector.apply(null, values);
95
+ } catch (ex) {
96
+ observer.onError(ex);
97
+ return;
98
+ }
99
+ observer.onNext(res);
100
+ } else if (isDone) {
101
+ observer.onCompleted();
102
+ }
103
+ }
104
+
105
+ return new CompositeDisposable(
106
+ source.subscribe(
107
+ function (x) {
108
+ next(x, 0);
109
+ },
110
+ observer.onError.bind(observer),
111
+ function () {
112
+ isDone = true;
113
+ observer.onCompleted();
114
+ }),
115
+ subject.subscribe(
116
+ function (x) {
117
+ next(x, 1);
118
+ },
119
+ observer.onError.bind(observer))
120
+ );
121
+ });
122
+ }
123
+
124
+ /**
125
+ * Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
126
+ * and yields the values that were buffered while paused.
127
+ * @example
128
+ * var pauser = new Rx.Subject();
129
+ * var source = Rx.Observable.interval(100).pausableBuffered(pauser);
130
+ * @param {Observable} pauser The observable sequence used to pause the underlying sequence.
131
+ * @returns {Observable} The observable sequence which is paused based upon the pauser.
132
+ */
133
+ observableProto.pausableBuffered = function (subject) {
134
+ var source = this;
135
+ return new AnonymousObservable(function (observer) {
136
+ var q = [], previous = true;
137
+
138
+ var subscription =
139
+ combineLatestSource(
140
+ source,
141
+ subject.distinctUntilChanged(),
142
+ function (data, shouldFire) {
143
+ return { data: data, shouldFire: shouldFire };
144
+ })
145
+ .subscribe(
146
+ function (results) {
147
+ if (results.shouldFire && previous) {
148
+ observer.onNext(results.data);
149
+ }
150
+ if (results.shouldFire && !previous) {
151
+ while (q.length > 0) {
152
+ observer.onNext(q.shift());
153
+ }
154
+ previous = true;
155
+ } else if (!results.shouldFire && !previous) {
156
+ q.push(results.data);
157
+ } else if (!results.shouldFire && previous) {
158
+ previous = false;
159
+ }
160
+
161
+ },
162
+ observer.onError.bind(observer),
163
+ observer.onCompleted.bind(observer)
164
+ );
165
+
166
+ subject.onNext(false);
167
+
168
+ return subscription;
169
+ });
170
+ };
171
+
172
+ /**
173
+ * Attaches a controller to the observable sequence with the ability to queue.
174
+ * @example
175
+ * var source = Rx.Observable.interval(100).controlled();
176
+ * source.request(3); // Reads 3 values
177
+ * @param {Observable} pauser The observable sequence used to pause the underlying sequence.
178
+ * @returns {Observable} The observable sequence which is paused based upon the pauser.
179
+ */
180
+ observableProto.controlled = function (enableQueue) {
181
+ if (enableQueue == null) { enableQueue = true; }
182
+ return new ControlledObservable(this, enableQueue);
183
+ };
184
+ var ControlledObservable = (function (_super) {
185
+
186
+ inherits(ControlledObservable, _super);
187
+
188
+ function subscribe (observer) {
189
+ return this.source.subscribe(observer);
190
+ }
191
+
192
+ function ControlledObservable (source, enableQueue) {
193
+ _super.call(this, subscribe);
194
+ this.subject = new ControlledSubject(enableQueue);
195
+ this.source = source.multicast(this.subject).refCount();
196
+ }
197
+
198
+ ControlledObservable.prototype.request = function (numberOfItems) {
199
+ if (numberOfItems == null) { numberOfItems = -1; }
200
+ return this.subject.request(numberOfItems);
201
+ };
202
+
203
+ return ControlledObservable;
204
+
205
+ }(Observable));
206
+
207
+ var ControlledSubject = Rx.ControlledSubject = (function (_super) {
208
+
209
+ function subscribe (observer) {
210
+ return this.subject.subscribe(observer);
211
+ }
212
+
213
+ inherits(ControlledSubject, _super);
214
+
215
+ function ControlledSubject(enableQueue) {
216
+ if (enableQueue == null) {
217
+ enableQueue = true;
218
+ }
219
+
220
+ _super.call(this, subscribe);
221
+ this.subject = new Subject();
222
+ this.enableQueue = enableQueue;
223
+ this.queue = enableQueue ? [] : null;
224
+ this.requestedCount = 0;
225
+ this.requestedDisposable = disposableEmpty;
226
+ this.error = null;
227
+ this.hasFailed = false;
228
+ this.hasCompleted = false;
229
+ this.controlledDisposable = disposableEmpty;
230
+ }
231
+
232
+ addProperties(ControlledSubject.prototype, Observer, {
233
+ onCompleted: function () {
234
+ checkDisposed.call(this);
235
+ this.hasCompleted = true;
236
+
237
+ if (!this.enableQueue || this.queue.length === 0) {
238
+ this.subject.onCompleted();
239
+ }
240
+ },
241
+ onError: function (error) {
242
+ checkDisposed.call(this);
243
+ this.hasFailed = true;
244
+ this.error = error;
245
+
246
+ if (!this.enableQueue || this.queue.length === 0) {
247
+ this.subject.onError(error);
248
+ }
249
+ },
250
+ onNext: function (value) {
251
+ checkDisposed.call(this);
252
+ var hasRequested = false;
253
+
254
+ if (this.requestedCount === 0) {
255
+ if (this.enableQueue) {
256
+ this.queue.push(value);
257
+ }
258
+ } else {
259
+ if (this.requestedCount !== -1) {
260
+ if (this.requestedCount-- === 0) {
261
+ this.disposeCurrentRequest();
262
+ }
263
+ }
264
+ hasRequested = true;
265
+ }
266
+
267
+ if (hasRequested) {
268
+ this.subject.onNext(value);
269
+ }
270
+ },
271
+ _processRequest: function (numberOfItems) {
272
+ if (this.enableQueue) {
273
+ //console.log('queue length', this.queue.length);
274
+
275
+ while (this.queue.length >= numberOfItems && numberOfItems > 0) {
276
+ //console.log('number of items', numberOfItems);
277
+ this.subject.onNext(this.queue.shift());
278
+ numberOfItems--;
279
+ }
280
+
281
+ if (this.queue.length !== 0) {
282
+ return { numberOfItems: numberOfItems, returnValue: true };
283
+ } else {
284
+ return { numberOfItems: numberOfItems, returnValue: false };
285
+ }
286
+ }
287
+
288
+ if (this.hasFailed) {
289
+ this.subject.onError(this.error);
290
+ this.controlledDisposable.dispose();
291
+ this.controlledDisposable = disposableEmpty;
292
+ } else if (this.hasCompleted) {
293
+ this.subject.onCompleted();
294
+ this.controlledDisposable.dispose();
295
+ this.controlledDisposable = disposableEmpty;
296
+ }
297
+
298
+ return { numberOfItems: numberOfItems, returnValue: false };
299
+ },
300
+ request: function (number) {
301
+ checkDisposed.call(this);
302
+ this.disposeCurrentRequest();
303
+ var self = this,
304
+ r = this._processRequest(number);
305
+
306
+ number = r.numberOfItems;
307
+ if (!r.returnValue) {
308
+ this.requestedCount = number;
309
+ this.requestedDisposable = disposableCreate(function () {
310
+ self.requestedCount = 0;
311
+ });
312
+
313
+ return this.requestedDisposable
314
+ } else {
315
+ return disposableEmpty;
316
+ }
317
+ },
318
+ disposeCurrentRequest: function () {
319
+ this.requestedDisposable.dispose();
320
+ this.requestedDisposable = disposableEmpty;
321
+ },
322
+
323
+ dispose: function () {
324
+ this.isDisposed = true;
325
+ this.error = null;
326
+ this.subject.dispose();
327
+ this.requestedDisposable.dispose();
328
+ }
329
+ });
330
+
331
+ return ControlledSubject;
332
+ }(Observable));
80
333
  return Rx;
81
334
  }));
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){{var d=c.Observable,e=d.prototype,f=c.Internals.AnonymousObservable,g=(c.Subject,c.Observer,c.Disposable.empty);c.Disposable.create,c.Internals.inherits,c.Internals.addProperties,c.Scheduler.timeout}return e.pausable=function(a){var b=this;return new f(function(c){var d=b.publish(),e=d.subscribe(c),f=g,h=a.distinctUntilChanged().subscribe(function(a){a?f=d.connect():(f.dispose(),f=g)});return new CompositeDisposable(e,f,h)})},c});
1
+ (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(){if(this.isDisposed)throw new Error(q)}function e(a){return a}function f(a,b,c){return new i(function(d){function f(a,b){l[b]=a;var f;if(h[b]=!0,i||(i=h.every(e))){try{f=c.apply(null,l)}catch(g){return d.onError(g),void 0}d.onNext(f)}else k&&d.onCompleted()}var g=2,h=[!1,!1],i=!1,k=!1,l=new Array(g);return new j(a.subscribe(function(a){f(a,0)},d.onError.bind(d),function(){k=!0,d.onCompleted()}),b.subscribe(function(a){f(a,1)},d.onError.bind(d)))})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=c.CompositeDisposable,k=c.Subject,l=c.Observer,m=c.Disposable.empty,n=c.Disposable.create,o=c.internals.inherits,p=c.internals.addProperties,q=(c.Scheduler.timeout,"Object has been disposed");h.pausable=function(a){var b=this;return new i(function(c){var d=b.publish(),e=d.subscribe(c),f=m,g=a.distinctUntilChanged().subscribe(function(a){a?f=d.connect():(f.dispose(),f=m)});return new j(e,f,g)})},h.pausableBuffered=function(a){var b=this;return new i(function(c){var d=[],e=!0,g=f(b,a.distinctUntilChanged(),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(a){if(a.shouldFire&&e&&c.onNext(a.data),a.shouldFire&&!e){for(;d.length>0;)c.onNext(d.shift());e=!0}else a.shouldFire||e?!a.shouldFire&&e&&(e=!1):d.push(a.data)},c.onError.bind(c),c.onCompleted.bind(c));return a.onNext(!1),g})},h.controlled=function(a){return null==a&&(a=!0),new r(this,a)};var r=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new s(d),this.source=c.multicast(this.subject).refCount()}return o(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(g),s=c.ControlledSubject=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new k,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=m,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=m}return o(c,a),p(c.prototype,l,{onCompleted:function(){d.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){d.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){d.call(this);var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=m):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=m),{numberOfItems:a,returnValue:!1}},request:function(a){d.call(this),this.disposeCurrentRequest();var b=this,c=this._processRequest(a);return a=c.numberOfItems,c.returnValue?m:(this.requestedCount=a,this.requestedDisposable=n(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=m},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),c}(g);return c});