Skip to content

Instantly share code, notes, and snippets.

@tusharmath
Last active April 30, 2016 14:12
Show Gist options
  • Save tusharmath/f40a9b3dc36aa1ef3eea1754c7689ab0 to your computer and use it in GitHub Desktop.
Save tusharmath/f40a9b3dc36aa1ef3eea1754c7689ab0 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!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>
// 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))
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"rx": "4.1.0"
}
}
'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