This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rx.Observable.select = function (element, source) { | |
return source.select(function (value) { | |
return { | |
element: element, | |
value: value | |
}; | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rx.Observable.prototype.obsFilter = function (func) { | |
var self = this; | |
return Rx.Observable.createWithDisposable(function (o) { | |
self.subscribe(function (source) { | |
var subject = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
namespace ReactivePrimitives | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flatMap (array, func) { | |
return Array.prototype.concat.apply([], array.map(func)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
var items = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } | |
.Select(x => | |
{ | |
Console.WriteLine(x); | |
return x; | |
}) | |
.Select(x => Observable.Range(x, 1)) | |
.Concat() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rx.Observable.combineTemplate = function(sources) { | |
var keys = []; | |
var values = []; | |
for (var key in sources) { | |
keys.push(key); | |
values.push(sources[key]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// combineLatest(obs1, obs2, selector) | |
// combineLatest([obs1, obs2], selector) | |
observableProto.combineLatest = function () { | |
var args = slice.call(arguments); | |
// (args[0] instanceof Array ? args[0] : args).unshift(this); | |
if (args[0] instanceof Array) { | |
args[0].unshift(this); | |
} else { | |
args.unshift(this); |
NewerOlder