rxjs-rails 2.3.10 → 2.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +120 -70
- data/vendor/assets/javascripts/rx.aggregates.min.js +3 -1
- data/vendor/assets/javascripts/rx.all.compat.js +1810 -1849
- data/vendor/assets/javascripts/rx.all.compat.min.js +5 -3
- data/vendor/assets/javascripts/rx.all.js +1776 -1815
- data/vendor/assets/javascripts/rx.all.min.js +5 -3
- data/vendor/assets/javascripts/rx.async.compat.js +45 -45
- data/vendor/assets/javascripts/rx.async.compat.min.js +3 -1
- data/vendor/assets/javascripts/rx.async.js +39 -39
- data/vendor/assets/javascripts/rx.async.min.js +3 -1
- data/vendor/assets/javascripts/rx.backpressure.js +21 -19
- data/vendor/assets/javascripts/rx.backpressure.min.js +3 -1
- data/vendor/assets/javascripts/rx.binding.js +90 -90
- data/vendor/assets/javascripts/rx.binding.min.js +3 -1
- data/vendor/assets/javascripts/rx.coincidence.js +184 -179
- data/vendor/assets/javascripts/rx.coincidence.min.js +3 -1
- data/vendor/assets/javascripts/rx.compat.js +1019 -1001
- data/vendor/assets/javascripts/rx.compat.min.js +4 -2
- data/vendor/assets/javascripts/rx.experimental.js +65 -64
- data/vendor/assets/javascripts/rx.experimental.min.js +3 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +265 -363
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +3 -1
- data/vendor/assets/javascripts/rx.js +969 -951
- data/vendor/assets/javascripts/rx.lite.compat.js +1014 -1182
- data/vendor/assets/javascripts/rx.lite.compat.min.js +4 -2
- data/vendor/assets/javascripts/rx.lite.extras.js +101 -109
- data/vendor/assets/javascripts/rx.lite.extras.min.js +3 -1
- data/vendor/assets/javascripts/rx.lite.js +1008 -1176
- data/vendor/assets/javascripts/rx.lite.min.js +4 -2
- data/vendor/assets/javascripts/rx.min.js +4 -2
- data/vendor/assets/javascripts/rx.testing.js +196 -196
- data/vendor/assets/javascripts/rx.testing.min.js +3 -1
- data/vendor/assets/javascripts/rx.time.js +162 -178
- data/vendor/assets/javascripts/rx.time.min.js +3 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +30 -30
- data/vendor/assets/javascripts/rx.virtualtime.min.js +3 -1
- metadata +2 -6
- data/vendor/assets/javascripts/rx.core.compat.js +0 -2548
- data/vendor/assets/javascripts/rx.core.compat.min.js +0 -1
- data/vendor/assets/javascripts/rx.core.js +0 -2430
- data/vendor/assets/javascripts/rx.core.min.js +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
1
|
+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
2
|
|
3
3
|
;(function (factory) {
|
4
4
|
var objectTypes = {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
16
16
|
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
17
17
|
freeGlobal = objectTypes[typeof global] && global;
|
18
|
-
|
18
|
+
|
19
19
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
|
20
20
|
root = freeGlobal;
|
21
21
|
}
|
@@ -32,7 +32,7 @@
|
|
32
32
|
root.Rx = factory(root, {}, root.Rx);
|
33
33
|
}
|
34
34
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
|
-
|
35
|
+
|
36
36
|
// Aliases
|
37
37
|
var Observable = Rx.Observable,
|
38
38
|
observableProto = Observable.prototype,
|
@@ -48,7 +48,7 @@
|
|
48
48
|
slice = Array.prototype.slice;
|
49
49
|
|
50
50
|
var fnString = 'function';
|
51
|
-
|
51
|
+
|
52
52
|
function toThunk(obj, ctx) {
|
53
53
|
if (Array.isArray(obj)) {
|
54
54
|
return objectToThunk.call(ctx, obj);
|
@@ -149,7 +149,7 @@
|
|
149
149
|
fn(null, res);
|
150
150
|
}, fn);
|
151
151
|
}
|
152
|
-
}
|
152
|
+
}
|
153
153
|
|
154
154
|
function isObservable(obj) {
|
155
155
|
return obj && obj.prototype.subscribe === fnString;
|
@@ -167,7 +167,7 @@
|
|
167
167
|
return val && val.constructor === Object;
|
168
168
|
}
|
169
169
|
|
170
|
-
/*
|
170
|
+
/*
|
171
171
|
* Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
|
172
172
|
* @param {Function} The spawning function.
|
173
173
|
* @returns {Function} a function which has a done continuation.
|
@@ -180,7 +180,7 @@
|
|
180
180
|
gen = fan;
|
181
181
|
|
182
182
|
if (isGenFun) {
|
183
|
-
var args = slice.call(arguments),
|
183
|
+
var args = slice.call(arguments),
|
184
184
|
len = args.length,
|
185
185
|
hasCallback = len && typeof args[len - 1] === fnString;
|
186
186
|
|
@@ -228,7 +228,7 @@
|
|
228
228
|
var called = false;
|
229
229
|
try {
|
230
230
|
ret.value.call(ctx, function(){
|
231
|
-
if (called) {
|
231
|
+
if (called) {
|
232
232
|
return;
|
233
233
|
}
|
234
234
|
|
@@ -237,7 +237,7 @@
|
|
237
237
|
});
|
238
238
|
} catch (e) {
|
239
239
|
timeoutScheduler.schedule(function () {
|
240
|
-
if (called) {
|
240
|
+
if (called) {
|
241
241
|
return;
|
242
242
|
}
|
243
243
|
|
@@ -251,7 +251,7 @@
|
|
251
251
|
// Not supported
|
252
252
|
next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
|
253
253
|
}
|
254
|
-
}
|
254
|
+
}
|
255
255
|
};
|
256
256
|
|
257
257
|
/**
|
@@ -286,24 +286,24 @@
|
|
286
286
|
}
|
287
287
|
}
|
288
288
|
}
|
289
|
-
};
|
289
|
+
};
|
290
290
|
|
291
291
|
/**
|
292
292
|
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
|
293
|
-
*
|
293
|
+
*
|
294
294
|
* @example
|
295
295
|
* var res = Rx.Observable.start(function () { console.log('hello'); });
|
296
296
|
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
|
297
297
|
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
|
298
|
-
*
|
298
|
+
*
|
299
299
|
* @param {Function} func Function to run asynchronously.
|
300
300
|
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
|
301
301
|
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
302
302
|
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
|
303
|
-
*
|
303
|
+
*
|
304
304
|
* Remarks
|
305
305
|
* * The function is called immediately, not during the subscription of the resulting sequence.
|
306
|
-
* * Multiple subscriptions to the resulting sequence can observe the function's result.
|
306
|
+
* * Multiple subscriptions to the resulting sequence can observe the function's result.
|
307
307
|
*/
|
308
308
|
Observable.start = function (func, context, scheduler) {
|
309
309
|
return observableToAsync(func, context, scheduler)();
|
@@ -311,12 +311,12 @@
|
|
311
311
|
|
312
312
|
/**
|
313
313
|
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
|
314
|
-
*
|
314
|
+
*
|
315
315
|
* @example
|
316
316
|
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3);
|
317
317
|
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3);
|
318
318
|
* var res = Rx.Observable.toAsync(function (x) { this.log(x); }, Rx.Scheduler.timeout, console)('hello');
|
319
|
-
*
|
319
|
+
*
|
320
320
|
* @param {Function} function Function to convert to an asynchronous function.
|
321
321
|
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
|
322
322
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
@@ -325,7 +325,7 @@
|
|
325
325
|
var observableToAsync = Observable.toAsync = function (func, context, scheduler) {
|
326
326
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
327
327
|
return function () {
|
328
|
-
var args = arguments,
|
328
|
+
var args = arguments,
|
329
329
|
subject = new AsyncSubject();
|
330
330
|
|
331
331
|
scheduler.schedule(function () {
|
@@ -344,8 +344,8 @@
|
|
344
344
|
};
|
345
345
|
|
346
346
|
/**
|
347
|
-
* Converts a callback function to an observable sequence.
|
348
|
-
*
|
347
|
+
* Converts a callback function to an observable sequence.
|
348
|
+
*
|
349
349
|
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
|
350
350
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
351
351
|
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
|
@@ -358,7 +358,7 @@
|
|
358
358
|
return new AnonymousObservable(function (observer) {
|
359
359
|
function handler(e) {
|
360
360
|
var results = e;
|
361
|
-
|
361
|
+
|
362
362
|
if (selector) {
|
363
363
|
try {
|
364
364
|
results = selector(arguments);
|
@@ -369,13 +369,13 @@
|
|
369
369
|
|
370
370
|
observer.onNext(results);
|
371
371
|
} else {
|
372
|
-
if (results.length <= 1) {
|
372
|
+
if (results.length <= 1) {
|
373
373
|
observer.onNext.apply(observer, results);
|
374
374
|
} else {
|
375
375
|
observer.onNext(results);
|
376
376
|
}
|
377
377
|
}
|
378
|
-
|
378
|
+
|
379
379
|
observer.onCompleted();
|
380
380
|
}
|
381
381
|
|
@@ -389,7 +389,7 @@
|
|
389
389
|
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
|
390
390
|
* @param {Function} func The function to call
|
391
391
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
392
|
-
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
|
392
|
+
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
|
393
393
|
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
|
394
394
|
*/
|
395
395
|
Observable.fromNodeCallback = function (func, context, selector) {
|
@@ -404,7 +404,7 @@
|
|
404
404
|
}
|
405
405
|
|
406
406
|
var results = slice.call(arguments, 1);
|
407
|
-
|
407
|
+
|
408
408
|
if (selector) {
|
409
409
|
try {
|
410
410
|
results = selector(results);
|
@@ -414,7 +414,7 @@
|
|
414
414
|
}
|
415
415
|
observer.onNext(results);
|
416
416
|
} else {
|
417
|
-
if (results.length <= 1) {
|
417
|
+
if (results.length <= 1) {
|
418
418
|
observer.onNext.apply(observer, results);
|
419
419
|
} else {
|
420
420
|
observer.onNext(results);
|
@@ -449,7 +449,7 @@
|
|
449
449
|
|
450
450
|
event || (event = root.event);
|
451
451
|
if (!event.target) {
|
452
|
-
event.target = event.target || event.srcElement;
|
452
|
+
event.target = event.target || event.srcElement;
|
453
453
|
|
454
454
|
if (event.type == 'mouseover') {
|
455
455
|
event.relatedTarget = event.fromElement;
|
@@ -470,14 +470,14 @@
|
|
470
470
|
c = 0;
|
471
471
|
event.keyCode = 13;
|
472
472
|
} else if (c == 13 || c == 27) {
|
473
|
-
c = 0;
|
473
|
+
c = 0;
|
474
474
|
} else if (c == 3) {
|
475
|
-
c = 99;
|
475
|
+
c = 99;
|
476
476
|
}
|
477
477
|
event.charCode = c;
|
478
478
|
event.keyChar = event.charCode ? String.fromCharCode(event.charCode) : '';
|
479
479
|
break;
|
480
|
-
}
|
480
|
+
}
|
481
481
|
}
|
482
482
|
|
483
483
|
return event;
|
@@ -490,7 +490,7 @@
|
|
490
490
|
return disposableCreate(function () {
|
491
491
|
element.removeEventListener(name, handler, false);
|
492
492
|
});
|
493
|
-
}
|
493
|
+
}
|
494
494
|
if (element.attachEvent) {
|
495
495
|
// IE Specific
|
496
496
|
var innerHandler = function (event) {
|
@@ -499,9 +499,9 @@
|
|
499
499
|
element.attachEvent('on' + name, innerHandler);
|
500
500
|
return disposableCreate(function () {
|
501
501
|
element.detachEvent('on' + name, innerHandler);
|
502
|
-
});
|
502
|
+
});
|
503
503
|
}
|
504
|
-
// Level 1 DOM Events
|
504
|
+
// Level 1 DOM Events
|
505
505
|
element['on' + name] = handler;
|
506
506
|
return disposableCreate(function () {
|
507
507
|
element['on' + name] = null;
|
@@ -524,7 +524,7 @@
|
|
524
524
|
}
|
525
525
|
|
526
526
|
/**
|
527
|
-
* Configuration option to determine whether to use native events only
|
527
|
+
* Configuration option to determine whether to use native events only
|
528
528
|
*/
|
529
529
|
Rx.config.useNativeEvents = false;
|
530
530
|
|
@@ -536,7 +536,7 @@
|
|
536
536
|
|
537
537
|
// Check for ember
|
538
538
|
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
|
539
|
-
|
539
|
+
|
540
540
|
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
|
541
541
|
// for proper loading order!
|
542
542
|
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
|
@@ -546,10 +546,10 @@
|
|
546
546
|
*
|
547
547
|
* @example
|
548
548
|
* var source = Rx.Observable.fromEvent(element, 'mouseup');
|
549
|
-
*
|
549
|
+
*
|
550
550
|
* @param {Object} element The DOMElement or NodeList to attach a listener.
|
551
551
|
* @param {String} eventName The event name to attach the observable sequence.
|
552
|
-
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
552
|
+
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
553
553
|
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
|
554
554
|
*/
|
555
555
|
Observable.fromEvent = function (element, eventName, selector) {
|
@@ -559,7 +559,7 @@
|
|
559
559
|
function (h) { element.addListener(eventName, h); },
|
560
560
|
function (h) { element.removeListener(eventName, h); },
|
561
561
|
selector);
|
562
|
-
}
|
562
|
+
}
|
563
563
|
|
564
564
|
// Use only if non-native events are allowed
|
565
565
|
if (!Rx.config.useNativeEvents) {
|
@@ -574,7 +574,7 @@
|
|
574
574
|
function (h) { Ember.addListener(element, eventName, h); },
|
575
575
|
function (h) { Ember.removeListener(element, eventName, h); },
|
576
576
|
selector);
|
577
|
-
}
|
577
|
+
}
|
578
578
|
if (jq) {
|
579
579
|
var $elem = jq(element);
|
580
580
|
return fromEventPattern(
|
@@ -585,9 +585,9 @@
|
|
585
585
|
}
|
586
586
|
return new AnonymousObservable(function (observer) {
|
587
587
|
return createEventListener(
|
588
|
-
element,
|
589
|
-
eventName,
|
590
|
-
function handler (e) {
|
588
|
+
element,
|
589
|
+
eventName,
|
590
|
+
function handler (e) {
|
591
591
|
var results = e;
|
592
592
|
|
593
593
|
if (selector) {
|
@@ -599,7 +599,7 @@
|
|
599
599
|
}
|
600
600
|
}
|
601
601
|
|
602
|
-
observer.onNext(results);
|
602
|
+
observer.onNext(results);
|
603
603
|
});
|
604
604
|
}).publish().refCount();
|
605
605
|
};
|
@@ -650,5 +650,5 @@
|
|
650
650
|
return observableFromPromise(promise);
|
651
651
|
}
|
652
652
|
|
653
|
-
return Rx;
|
654
|
-
}));
|
653
|
+
return Rx;
|
654
|
+
}));
|
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
2
|
+
(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.binding","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(a,b){return Array.isArray(a)?e.call(b,a):h(a)?y(a.call(b)):i(a)?y(a):g(a)?observableToThunk(a):isPromise(a)?f(a):typeof a===x?a:j(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==x)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void u.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){a.then(function(a){b(null,a)},b)}}function g(a){return a&&a.prototype.subscribe===x}function h(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function i(a){return a&&typeof a.next===x&&typeof a.throw===x}function j(a){return a&&a.constructor===Object}function k(b){var c=function(){this.cancelBubble=!0},d=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(b||(b=a.event),!b.target)switch(b.target=b.target||b.srcElement,"mouseover"==b.type&&(b.relatedTarget=b.fromElement),"mouseout"==b.type&&(b.relatedTarget=b.toElement),b.stopPropagation||(b.stopPropagation=c,b.preventDefault=d),b.type){case"keypress":var e="charCode"in b?b.charCode:b.keyCode;10==e?(e=0,b.keyCode=13):13==e||27==e?e=0:3==e&&(e=99),b.charCode=e,b.keyChar=b.charCode?String.fromCharCode(b.charCode):""}return b}function l(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),s(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(k(a))};return a.attachEvent("on"+b,d),s(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,s(function(){a["on"+b]=null})}function m(a,b,c){var d=new t;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(m(a.item(e),b,c));else a&&d.add(l(a,b,c));return d}var n=c.Observable,o=(n.prototype,n.fromPromise),p=n.throwException,q=c.AnonymousObservable,r=c.AsyncSubject,s=c.Disposable.create,t=c.CompositeDisposable,u=(c.Scheduler.immediate,c.Scheduler.timeout),v=c.helpers.isScheduler,w=Array.prototype.slice,x="function",y=c.spawn=function(a){var b=h(a);return function(c){function e(a,b){u.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2&&(b=w.call(arguments,1)),a)try{c=h.throw(a)}catch(i){return e(i)}if(!a)try{c=h.next(b)}catch(i){return e(i)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==x)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var j=!1;try{c.value.call(g,function(){j||(j=!0,f.apply(g,arguments))})}catch(i){u.schedule(function(){j||(j=!0,f.call(g,i))})}}}var g=this,h=fan;if(b){var i=w.call(arguments),j=i.length,k=j&&typeof i[j-1]===x;c=k?i.pop():error,h=a.apply(this,i)}else c=c||error;f()}};c.denodify=function(a){return function(){var b,c,d,e=w.call(arguments);return e.push(function(){b=arguments,d&&!c&&(c=!0,cb.apply(this,b))}),a.apply(this,e),function(a){d=a,b&&!c&&(c=!0,a.apply(this,b))}}},n.start=function(a,b,c){return z(a,b,c)()};var z=n.toAsync=function(a,b,c){return v(c)||(c=u),function(){var d=arguments,e=new r;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};n.fromCallback=function(a,b,c){return function(){var d=w.call(arguments,0);return new q(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},n.fromNodeCallback=function(a,b,c){return function(){var d=w.call(arguments,0);return new q(function(e){function f(a){if(a)return void e.onError(a);var b=w.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},c.config.useNativeEvents=!1;var A=a.angular&&angular.element?angular.element:a.jQuery?a.jQuery:a.Zepto?a.Zepto:null,B=!!a.Ember&&"function"==typeof a.Ember.addListener,C=!!a.Backbone&&!!a.Backbone.Marionette;n.fromEvent=function(a,b,d){if(a.addListener)return D(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d);if(!c.config.useNativeEvents){if(C)return D(function(c){a.on(b,c)},function(c){a.off(b,c)},d);if(B)return D(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},d);if(A){var e=A(a);return D(function(a){e.on(b,a)},function(a){e.off(b,a)},d)}}return new q(function(c){return m(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount()};var D=n.fromEventPattern=function(a,b,c){return new q(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return s(function(){b&&b(e,f)})}).publish().refCount()};return n.startAsync=function(a){var b;try{b=a()}catch(c){return p(c)}return o(b)},c});
|
3
|
+
//# sourceMappingURL=rx.async.compat.map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
1
|
+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
2
|
|
3
3
|
;(function (factory) {
|
4
4
|
var objectTypes = {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
16
16
|
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
17
17
|
freeGlobal = objectTypes[typeof global] && global;
|
18
|
-
|
18
|
+
|
19
19
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
|
20
20
|
root = freeGlobal;
|
21
21
|
}
|
@@ -32,7 +32,7 @@
|
|
32
32
|
root.Rx = factory(root, {}, root.Rx);
|
33
33
|
}
|
34
34
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
|
-
|
35
|
+
|
36
36
|
// Aliases
|
37
37
|
var Observable = Rx.Observable,
|
38
38
|
observableProto = Observable.prototype,
|
@@ -48,7 +48,7 @@
|
|
48
48
|
slice = Array.prototype.slice;
|
49
49
|
|
50
50
|
var fnString = 'function';
|
51
|
-
|
51
|
+
|
52
52
|
function toThunk(obj, ctx) {
|
53
53
|
if (Array.isArray(obj)) {
|
54
54
|
return objectToThunk.call(ctx, obj);
|
@@ -149,7 +149,7 @@
|
|
149
149
|
fn(null, res);
|
150
150
|
}, fn);
|
151
151
|
}
|
152
|
-
}
|
152
|
+
}
|
153
153
|
|
154
154
|
function isObservable(obj) {
|
155
155
|
return obj && obj.prototype.subscribe === fnString;
|
@@ -167,7 +167,7 @@
|
|
167
167
|
return val && val.constructor === Object;
|
168
168
|
}
|
169
169
|
|
170
|
-
/*
|
170
|
+
/*
|
171
171
|
* Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
|
172
172
|
* @param {Function} The spawning function.
|
173
173
|
* @returns {Function} a function which has a done continuation.
|
@@ -180,7 +180,7 @@
|
|
180
180
|
gen = fan;
|
181
181
|
|
182
182
|
if (isGenFun) {
|
183
|
-
var args = slice.call(arguments),
|
183
|
+
var args = slice.call(arguments),
|
184
184
|
len = args.length,
|
185
185
|
hasCallback = len && typeof args[len - 1] === fnString;
|
186
186
|
|
@@ -228,7 +228,7 @@
|
|
228
228
|
var called = false;
|
229
229
|
try {
|
230
230
|
ret.value.call(ctx, function(){
|
231
|
-
if (called) {
|
231
|
+
if (called) {
|
232
232
|
return;
|
233
233
|
}
|
234
234
|
|
@@ -237,7 +237,7 @@
|
|
237
237
|
});
|
238
238
|
} catch (e) {
|
239
239
|
timeoutScheduler.schedule(function () {
|
240
|
-
if (called) {
|
240
|
+
if (called) {
|
241
241
|
return;
|
242
242
|
}
|
243
243
|
|
@@ -251,7 +251,7 @@
|
|
251
251
|
// Not supported
|
252
252
|
next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
|
253
253
|
}
|
254
|
-
}
|
254
|
+
}
|
255
255
|
};
|
256
256
|
|
257
257
|
/**
|
@@ -286,24 +286,24 @@
|
|
286
286
|
}
|
287
287
|
}
|
288
288
|
}
|
289
|
-
};
|
289
|
+
};
|
290
290
|
|
291
291
|
/**
|
292
292
|
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
|
293
|
-
*
|
293
|
+
*
|
294
294
|
* @example
|
295
295
|
* var res = Rx.Observable.start(function () { console.log('hello'); });
|
296
296
|
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
|
297
297
|
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
|
298
|
-
*
|
298
|
+
*
|
299
299
|
* @param {Function} func Function to run asynchronously.
|
300
300
|
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
|
301
301
|
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
302
302
|
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
|
303
|
-
*
|
303
|
+
*
|
304
304
|
* Remarks
|
305
305
|
* * The function is called immediately, not during the subscription of the resulting sequence.
|
306
|
-
* * Multiple subscriptions to the resulting sequence can observe the function's result.
|
306
|
+
* * Multiple subscriptions to the resulting sequence can observe the function's result.
|
307
307
|
*/
|
308
308
|
Observable.start = function (func, context, scheduler) {
|
309
309
|
return observableToAsync(func, context, scheduler)();
|
@@ -311,12 +311,12 @@
|
|
311
311
|
|
312
312
|
/**
|
313
313
|
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
|
314
|
-
*
|
314
|
+
*
|
315
315
|
* @example
|
316
316
|
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3);
|
317
317
|
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3);
|
318
318
|
* var res = Rx.Observable.toAsync(function (x) { this.log(x); }, Rx.Scheduler.timeout, console)('hello');
|
319
|
-
*
|
319
|
+
*
|
320
320
|
* @param {Function} function Function to convert to an asynchronous function.
|
321
321
|
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
|
322
322
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
@@ -325,7 +325,7 @@
|
|
325
325
|
var observableToAsync = Observable.toAsync = function (func, context, scheduler) {
|
326
326
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
327
327
|
return function () {
|
328
|
-
var args = arguments,
|
328
|
+
var args = arguments,
|
329
329
|
subject = new AsyncSubject();
|
330
330
|
|
331
331
|
scheduler.schedule(function () {
|
@@ -344,8 +344,8 @@
|
|
344
344
|
};
|
345
345
|
|
346
346
|
/**
|
347
|
-
* Converts a callback function to an observable sequence.
|
348
|
-
*
|
347
|
+
* Converts a callback function to an observable sequence.
|
348
|
+
*
|
349
349
|
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
|
350
350
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
351
351
|
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
|
@@ -358,7 +358,7 @@
|
|
358
358
|
return new AnonymousObservable(function (observer) {
|
359
359
|
function handler(e) {
|
360
360
|
var results = e;
|
361
|
-
|
361
|
+
|
362
362
|
if (selector) {
|
363
363
|
try {
|
364
364
|
results = selector(arguments);
|
@@ -369,13 +369,13 @@
|
|
369
369
|
|
370
370
|
observer.onNext(results);
|
371
371
|
} else {
|
372
|
-
if (results.length <= 1) {
|
372
|
+
if (results.length <= 1) {
|
373
373
|
observer.onNext.apply(observer, results);
|
374
374
|
} else {
|
375
375
|
observer.onNext(results);
|
376
376
|
}
|
377
377
|
}
|
378
|
-
|
378
|
+
|
379
379
|
observer.onCompleted();
|
380
380
|
}
|
381
381
|
|
@@ -389,7 +389,7 @@
|
|
389
389
|
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
|
390
390
|
* @param {Function} func The function to call
|
391
391
|
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
392
|
-
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
|
392
|
+
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
|
393
393
|
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
|
394
394
|
*/
|
395
395
|
Observable.fromNodeCallback = function (func, context, selector) {
|
@@ -404,7 +404,7 @@
|
|
404
404
|
}
|
405
405
|
|
406
406
|
var results = slice.call(arguments, 1);
|
407
|
-
|
407
|
+
|
408
408
|
if (selector) {
|
409
409
|
try {
|
410
410
|
results = selector(results);
|
@@ -414,7 +414,7 @@
|
|
414
414
|
}
|
415
415
|
observer.onNext(results);
|
416
416
|
} else {
|
417
|
-
if (results.length <= 1) {
|
417
|
+
if (results.length <= 1) {
|
418
418
|
observer.onNext.apply(observer, results);
|
419
419
|
} else {
|
420
420
|
observer.onNext(results);
|
@@ -456,7 +456,7 @@
|
|
456
456
|
}
|
457
457
|
|
458
458
|
/**
|
459
|
-
* Configuration option to determine whether to use native events only
|
459
|
+
* Configuration option to determine whether to use native events only
|
460
460
|
*/
|
461
461
|
Rx.config.useNativeEvents = false;
|
462
462
|
|
@@ -468,7 +468,7 @@
|
|
468
468
|
|
469
469
|
// Check for ember
|
470
470
|
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
|
471
|
-
|
471
|
+
|
472
472
|
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
|
473
473
|
// for proper loading order!
|
474
474
|
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
|
@@ -478,10 +478,10 @@
|
|
478
478
|
*
|
479
479
|
* @example
|
480
480
|
* var source = Rx.Observable.fromEvent(element, 'mouseup');
|
481
|
-
*
|
481
|
+
*
|
482
482
|
* @param {Object} element The DOMElement or NodeList to attach a listener.
|
483
483
|
* @param {String} eventName The event name to attach the observable sequence.
|
484
|
-
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
484
|
+
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
485
485
|
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
|
486
486
|
*/
|
487
487
|
Observable.fromEvent = function (element, eventName, selector) {
|
@@ -491,8 +491,8 @@
|
|
491
491
|
function (h) { element.addListener(eventName, h); },
|
492
492
|
function (h) { element.removeListener(eventName, h); },
|
493
493
|
selector);
|
494
|
-
}
|
495
|
-
|
494
|
+
}
|
495
|
+
|
496
496
|
// Use only if non-native events are allowed
|
497
497
|
if (!Rx.config.useNativeEvents) {
|
498
498
|
if (marionette) {
|
@@ -506,7 +506,7 @@
|
|
506
506
|
function (h) { Ember.addListener(element, eventName, h); },
|
507
507
|
function (h) { Ember.removeListener(element, eventName, h); },
|
508
508
|
selector);
|
509
|
-
}
|
509
|
+
}
|
510
510
|
if (jq) {
|
511
511
|
var $elem = jq(element);
|
512
512
|
return fromEventPattern(
|
@@ -517,9 +517,9 @@
|
|
517
517
|
}
|
518
518
|
return new AnonymousObservable(function (observer) {
|
519
519
|
return createEventListener(
|
520
|
-
element,
|
521
|
-
eventName,
|
522
|
-
function handler (e) {
|
520
|
+
element,
|
521
|
+
eventName,
|
522
|
+
function handler (e) {
|
523
523
|
var results = e;
|
524
524
|
|
525
525
|
if (selector) {
|
@@ -531,7 +531,7 @@
|
|
531
531
|
}
|
532
532
|
}
|
533
533
|
|
534
|
-
observer.onNext(results);
|
534
|
+
observer.onNext(results);
|
535
535
|
});
|
536
536
|
}).publish().refCount();
|
537
537
|
};
|
@@ -582,5 +582,5 @@
|
|
582
582
|
return observableFromPromise(promise);
|
583
583
|
}
|
584
584
|
|
585
|
-
return Rx;
|
586
|
-
}));
|
585
|
+
return Rx;
|
586
|
+
}));
|
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
2
|
+
(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.binding","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(a,b){return Array.isArray(a)?e.call(b,a):h(a)?x(a.call(b)):i(a)?x(a):g(a)?observableToThunk(a):isPromise(a)?f(a):typeof a===w?a:j(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==w)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void t.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){a.then(function(a){b(null,a)},b)}}function g(a){return a&&a.prototype.subscribe===w}function h(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function i(a){return a&&typeof a.next===w&&typeof a.throw===w}function j(a){return a&&a.constructor===Object}function k(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),r(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function l(a,b,c){var d=new s;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(l(a.item(e),b,c));else a&&d.add(k(a,b,c));return d}var m=c.Observable,n=(m.prototype,m.fromPromise),o=m.throwException,p=c.AnonymousObservable,q=c.AsyncSubject,r=c.Disposable.create,s=c.CompositeDisposable,t=(c.Scheduler.immediate,c.Scheduler.timeout),u=c.helpers.isScheduler,v=Array.prototype.slice,w="function",x=c.spawn=function(a){var b=h(a);return function(c){function e(a,b){t.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2&&(b=v.call(arguments,1)),a)try{c=h.throw(a)}catch(i){return e(i)}if(!a)try{c=h.next(b)}catch(i){return e(i)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==w)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var j=!1;try{c.value.call(g,function(){j||(j=!0,f.apply(g,arguments))})}catch(i){t.schedule(function(){j||(j=!0,f.call(g,i))})}}}var g=this,h=fan;if(b){var i=v.call(arguments),j=i.length,k=j&&typeof i[j-1]===w;c=k?i.pop():error,h=a.apply(this,i)}else c=c||error;f()}};c.denodify=function(a){return function(){var b,c,d,e=v.call(arguments);return e.push(function(){b=arguments,d&&!c&&(c=!0,cb.apply(this,b))}),a.apply(this,e),function(a){d=a,b&&!c&&(c=!0,a.apply(this,b))}}},m.start=function(a,b,c){return y(a,b,c)()};var y=m.toAsync=function(a,b,c){return u(c)||(c=t),function(){var d=arguments,e=new q;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};m.fromCallback=function(a,b,c){return function(){var d=v.call(arguments,0);return new p(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},m.fromNodeCallback=function(a,b,c){return function(){var d=v.call(arguments,0);return new p(function(e){function f(a){if(a)return void e.onError(a);var b=v.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},c.config.useNativeEvents=!1;var z=a.angular&&angular.element?angular.element:a.jQuery?a.jQuery:a.Zepto?a.Zepto:null,A=!!a.Ember&&"function"==typeof a.Ember.addListener,B=!!a.Backbone&&!!a.Backbone.Marionette;m.fromEvent=function(a,b,d){if(a.addListener)return C(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d);if(!c.config.useNativeEvents){if(B)return C(function(c){a.on(b,c)},function(c){a.off(b,c)},d);if(A)return C(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},d);if(z){var e=z(a);return C(function(a){e.on(b,a)},function(a){e.off(b,a)},d)}}return new p(function(c){return l(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount()};var C=m.fromEventPattern=function(a,b,c){return new p(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return r(function(){b&&b(e,f)})}).publish().refCount()};return m.startAsync=function(a){var b;try{b=a()}catch(c){return o(c)}return n(b)},c});
|
3
|
+
//# sourceMappingURL=rx.async.map
|