Created
April 3, 2015 07:26
-
-
Save naoya/37a762d8eeb95622c7e1 to your computer and use it in GitHub Desktop.
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
var Rx = require('rx'); | |
var stream1 = Rx.Observable.from(['a', 'b', 'c']); | |
var stream2 = Rx.Observable.from([1, 2, 3]); | |
var combined = stream1.combineLatest(stream2, function (x, y) { | |
return x + y; | |
}); | |
combined.subscribe(function (v) { | |
console.log(v); | |
}); | |
/* | |
$ node app-rxjs.js | |
a1 | |
b1 | |
b2 | |
c2 | |
c3 | |
*/ |
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
var Bacon = require('baconjs'); | |
var stream1 = Bacon.fromArray(['a', 'b', 'c']); | |
var stream2 = Bacon.fromArray([1, 2, 3]); | |
var combined = Bacon.combineWith(function(x, y) { | |
return x + y; | |
}, stream1, stream2).changes(); | |
combined.onValue(function (v) { | |
console.log(v); | |
}); | |
/* output | |
$ node app.js | |
c1 | |
c2 | |
c3 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment