made with esnextbin
Created
April 21, 2017 09:06
-
-
Save FeliciousX/afd9f157deb6b81ce2336012c6c763c6 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"/> | |
</head> | |
<body> | |
<div id="app">hello</div> | |
</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
import xs from 'xstream' | |
// const emit$ = xs.merge(xs.of('EMIT'), xs.never()) | |
const emit$ = xs.of('EMIT') | |
const map1 = emit$.mapTo(1) | |
const map2 = emit$.mapTo(2) | |
// emit$.addListener({next: console.log, complete: () => console.log('emit$ c')}); | |
map1.addListener({next: console.log, complete: () => console.log('1 c')}) | |
setTimeout(() => { | |
console.log('delayed'); | |
map2.addListener({next: console.log, complete: () => console.log('2 c')}) | |
}, 1000) |
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": { | |
"xstream": "10.2.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'; | |
var _xstream = require('xstream'); | |
var _xstream2 = _interopRequireDefault(_xstream); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
// const emit$ = xs.merge(xs.of('EMIT'), xs.never()) | |
var emit$ = _xstream2.default.of('EMIT'); | |
var map1 = emit$.mapTo(1); | |
var map2 = emit$.mapTo(2); | |
// emit$.addListener({next: console.log, complete: () => console.log('emit$ c')}); | |
map1.addListener({ next: console.log, complete: function complete() { | |
return console.log('1 c'); | |
} }); | |
setTimeout(function () { | |
console.log('delayed'); | |
map2.addListener({ next: console.log, complete: function complete() { | |
return console.log('2 c'); | |
} }); | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment