made with esnextbin
Last active
November 23, 2016 15:40
-
-
Save maxhoffmann/4e1952554ddb71f0e70ea4324f5f2cb1 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
const most = require('most'); | |
const producer = most.just().multicast(); | |
const working = most.combine(() => 0, producer).multicast(); | |
const broken = most.combine(() => 2, producer).startWith(1); | |
working.forEach(value => document.write('working: ' + value + '<br>')); | |
// expected: brokenConsumer should event 1 and 2 | |
broken.forEach(value => document.write('broken: ' + value + '<br>')); | |
// removing one of the multicasts fixes the bug | |
// removing startWith emits 2 |
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": { | |
"most": "1.0.5" | |
} | |
} |
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 most = require('most'); | |
var producer = most.just().multicast(); | |
var working = most.combine(function () { | |
return 0; | |
}, producer).multicast(); | |
var broken = most.combine(function () { | |
return 2; | |
}, producer).startWith(1); | |
working.forEach(function (value) { | |
return document.write('working: ' + value + '<br>'); | |
}); | |
// expected: brokenConsumer should event 1 and 2 | |
broken.forEach(function (value) { | |
return document.write('broken: ' + value + '<br>'); | |
}); | |
// removing one of the multicasts fixes the bug | |
// removing startWith emits 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment