Skip to content

Instantly share code, notes, and snippets.

@maxhoffmann
Last active November 23, 2016 15:40
Show Gist options
  • Select an option

  • Save maxhoffmann/4e1952554ddb71f0e70ea4324f5f2cb1 to your computer and use it in GitHub Desktop.

Select an option

Save maxhoffmann/4e1952554ddb71f0e70ea4324f5f2cb1 to your computer and use it in GitHub Desktop.

Revisions

  1. Maximilian Hoffmann revised this gist Nov 23, 2016. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    const most = require('most');

    const producer = most.just({ time: 0, value: false }).multicast();
    const producer = most.just().multicast();

    const working = most.combine(() => 0, producer).multicast();
    const broken = most.combine(() => 2, producer).startWith(1);
    2 changes: 1 addition & 1 deletion transpiled.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    var most = require('most');

    var producer = most.just({ time: 0, value: false }).multicast();
    var producer = most.just().multicast();

    var working = most.combine(function () {
    return 0;
  2. Maximilian Hoffmann revised this gist Nov 23, 2016. 2 changed files with 0 additions and 4 deletions.
    2 changes: 0 additions & 2 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,6 @@ const producer = most.just({ time: 0, value: false }).multicast();
    const working = most.combine(() => 0, producer).multicast();
    const broken = most.combine(() => 2, producer).startWith(1);

    console.clear();

    working.forEach(value => document.write('working: ' + value + '<br>'));

    // expected: brokenConsumer should event 1 and 2
    2 changes: 0 additions & 2 deletions transpiled.js
    Original file line number Diff line number Diff line change
    @@ -11,8 +11,6 @@ var broken = most.combine(function () {
    return 2;
    }, producer).startWith(1);

    console.clear();

    working.forEach(function (value) {
    return document.write('working: ' + value + '<br>');
    });
  3. Maximilian Hoffmann revised this gist Nov 23, 2016. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ const broken = most.combine(() => 2, producer).startWith(1);

    console.clear();

    working.forEach(value => document.write('broken: ' + value + '<br>'));
    working.forEach(value => document.write('working: ' + value + '<br>'));

    // expected: brokenConsumer should event 1 and 2
    broken.forEach(value => document.write('broken: ' + value + '<br>'));
    2 changes: 1 addition & 1 deletion transpiled.js
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ var broken = most.combine(function () {
    console.clear();

    working.forEach(function (value) {
    return document.write('broken: ' + value + '<br>');
    return document.write('working: ' + value + '<br>');
    });

    // expected: brokenConsumer should event 1 and 2
  4. Maximilian Hoffmann revised this gist Nov 23, 2016. 3 changed files with 9 additions and 5 deletions.
    2 changes: 1 addition & 1 deletion esnextbin.md
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    made with [esnextbin](http://esnextb.in)
    made with [esnextbin](http://esnextb.in/?gist=4e1952554ddb71f0e70ea4324f5f2cb1)
    4 changes: 2 additions & 2 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,10 @@ const broken = most.combine(() => 2, producer).startWith(1);

    console.clear();

    working.forEach(console.log.bind(console, 'working:'));
    working.forEach(value => document.write('broken: ' + value + '<br>'));

    // expected: brokenConsumer should event 1 and 2
    broken.forEach(console.log.bind(console, 'broken:'));
    broken.forEach(value => document.write('broken: ' + value + '<br>'));

    // removing one of the multicasts fixes the bug
    // removing startWith emits 2
    8 changes: 6 additions & 2 deletions transpiled.js
    Original file line number Diff line number Diff line change
    @@ -13,10 +13,14 @@ var broken = most.combine(function () {

    console.clear();

    working.forEach(console.log.bind(console, 'working:'));
    working.forEach(function (value) {
    return document.write('broken: ' + value + '<br>');
    });

    // expected: brokenConsumer should event 1 and 2
    broken.forEach(console.log.bind(console, 'broken:'));
    broken.forEach(function (value) {
    return document.write('broken: ' + value + '<br>');
    });

    // removing one of the multicasts fixes the bug
    // removing startWith emits 2
  5. Maximilian Hoffmann created this gist Nov 23, 2016.
    1 change: 1 addition & 0 deletions esnextbin.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    made with [esnextbin](http://esnextb.in)
    11 changes: 11 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <!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>
    16 changes: 16 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    const most = require('most');

    const producer = most.just({ time: 0, value: false }).multicast();

    const working = most.combine(() => 0, producer).multicast();
    const broken = most.combine(() => 2, producer).startWith(1);

    console.clear();

    working.forEach(console.log.bind(console, 'working:'));

    // expected: brokenConsumer should event 1 and 2
    broken.forEach(console.log.bind(console, 'broken:'));

    // removing one of the multicasts fixes the bug
    // removing startWith emits 2
    7 changes: 7 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    {
    "name": "esnextbin-sketch",
    "version": "0.0.0",
    "dependencies": {
    "most": "1.0.5"
    }
    }
    22 changes: 22 additions & 0 deletions transpiled.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    'use strict';

    var most = require('most');

    var producer = most.just({ time: 0, value: false }).multicast();

    var working = most.combine(function () {
    return 0;
    }, producer).multicast();
    var broken = most.combine(function () {
    return 2;
    }, producer).startWith(1);

    console.clear();

    working.forEach(console.log.bind(console, 'working:'));

    // expected: brokenConsumer should event 1 and 2
    broken.forEach(console.log.bind(console, 'broken:'));

    // removing one of the multicasts fixes the bug
    // removing startWith emits 2