made with esnextbin
Last active
April 30, 2016 14:12
-
-
Save tusharmath/f40a9b3dc36aa1ef3eea1754c7689ab0 to your computer and use it in GitHub Desktop.
esnextbin sketch
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"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</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
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
const {Observable} = require('rx') | |
const double = (num$) => num$ | |
.tap(x => console.log(x)) | |
.map((x) => x * 2) | |
.delay(100) | |
const proxy$ = Observable.start(() => num$).mergeAll() | |
const num$ = double(proxy$.startWith(1)) | |
num$ | |
.take(5) | |
.subscribe((x) => console.log('OUT', x)) |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"rx": "4.1.0" | |
} | |
} |
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'; | |
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
var _require = require('rx'); | |
var Observable = _require.Observable; | |
var double = function double(num$) { | |
return num$.tap(function (x) { | |
return console.log(x); | |
}).map(function (x) { | |
return x * 2; | |
}).delay(100); | |
}; | |
var proxy$ = Observable.start(function () { | |
return num$; | |
}).mergeAll(); | |
var num$ = double(proxy$.startWith(1)); | |
num$.take(5).subscribe(function (x) { | |
return console.log('OUT', x); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment