Skip to content

Instantly share code, notes, and snippets.

@maxhoffmann
Last active November 23, 2016 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxhoffmann/4e1952554ddb71f0e70ea4324f5f2cb1 to your computer and use it in GitHub Desktop.
Save maxhoffmann/4e1952554ddb71f0e70ea4324f5f2cb1 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>
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
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"most": "1.0.5"
}
}
'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