View selectmany.js
1 2 3 4 5 6 7 8 9 10
function flatMap(source, selector, thisArg) {
var selectorFn = isFunction(selector) ? bindCallback(selector, thisArg, 3) : function () { return selector; };
return new AnonymousObservable(function(observer) {
var sad = new SingleAssignmentDisposable();
var g = new CompositeDisposable();
g.add(sad);
var isStopped = false;
var i = 0;
sad.setDisposable(source.subscribe(
function (value) {
View combinelatest.js
1 2 3 4 5 6 7 8 9 10
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
View CompositeDisposable.js
1 2 3 4 5 6 7 8 9 10
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
var disposables = [];
if (Array.isArray(arguments[0])) {
disposables = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { disposables.push(arguments[i]); }
View foo.js
1 2 3 4 5 6 7 8 9 10
// Using anon functions
var source = self;
return new AnonymousObservable(function (o) {
return source.subscribe(
function (x) { o.onNext(x); },
function (e) { o.onError(e); },
function () { o.onCompleted(); })
});
 
// Using binders
View defer-concat.cs
1 2 3 4 5 6 7 8 9 10
var parents = new[]
{
new
{
name = "stu",
children = new[]
{
new {name = "john"},
new {name = "audrey"},
new {name = "eustace"}
View transducer.js
1 2 3 4 5 6 7 8 9 10
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
 
function transformForObserver(observer) {
return {
View why.js
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env node-forward
var Rx = require('rx'),
EventEmitter = require('events').EventEmitter,
fromEvent = Rx.Observable.fromEvent;
 
function throwError(err) {
return Rx.Observable.throw(err);
}
 
// Could be any data source
View rx-example.js
1 2 3 4 5 6 7 8 9 10
function* fibonacci(){
var fn1 = 1;
var fn2 = 1;
while (1){
var current = fn2;
fn2 = fn1;
fn1 = fn1 + current;
yield current;
}
}
View ix-example.js
1 2 3 4 5 6 7 8 9 10
function* fibonacci(){
var fn1 = 1;
var fn2 = 1;
while (1){
var current = fn2;
fn2 = fn1;
fn1 = fn1 + current;
yield current;
}
}
View example.js
1 2 3 4 5 6 7 8 9
function include (jsFile) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile(jsFile),
s = f.ReadAll();
f.Close();
return s;
}
 
eval(include('C:\\GitHub\\RxJS\\dist\\rx.all.compat.js'));
Something went wrong with that request. Please try again.