Created
March 17, 2017 13:05
-
-
Save danimality/3f03960b4ea7d7669f0a1c41c413c72c to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/latadij
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script> | |
<script id="jsbin-javascript"> | |
'use strict'; | |
var source1 = Rx.Observable.interval(140).map(function (i) { | |
return 'First: ' + i; | |
}); | |
var source2 = Rx.Observable.interval(50).map(function (i) { | |
return 'Second: ' + i; | |
}); | |
var source3 = Rx.Observable.interval(240).map(function (i) { | |
return 'Third: ' + i; | |
}); | |
var comb = source1.withLatestFrom(source2, source3, function (a, b, c) { | |
return a + ' ' + b + ' ' + c; | |
}).take(10); | |
comb.subscribe(function (x) { | |
return console.log(x); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var source1 = Rx.Observable.interval(140) | |
.map(function (i) { return 'First: ' + i; }); | |
var source2 = Rx.Observable.interval(50) | |
.map(function (i) { return 'Second: ' + i; }); | |
var source3 = Rx.Observable.interval(240) | |
.map(function (i) { return 'Third: ' + i; }); | |
var comb = source1.withLatestFrom(source2, source3, (a,b,c) => a + ' ' + b + ' ' + c).take(10); | |
comb.subscribe(x => console.log(x));</script></body> | |
</html> |
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
'use strict'; | |
var source1 = Rx.Observable.interval(140).map(function (i) { | |
return 'First: ' + i; | |
}); | |
var source2 = Rx.Observable.interval(50).map(function (i) { | |
return 'Second: ' + i; | |
}); | |
var source3 = Rx.Observable.interval(240).map(function (i) { | |
return 'Third: ' + i; | |
}); | |
var comb = source1.withLatestFrom(source2, source3, function (a, b, c) { | |
return a + ' ' + b + ' ' + c; | |
}).take(10); | |
comb.subscribe(function (x) { | |
return console.log(x); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment