Dropping button click events until last reset event not working
<p>Using cycle.js and xstream, I would like to count button clicks and reset them. </p>

<p>I was planning to achieve this by counting all button clicks after the last reset. To do this I thought of dropping all button clicks until the last reset, and counting what's left.</p>

<p>However I'm left with 2 buttons that are not working</p>

<p>Any advice? </p>

<pre><code>function main(sources: ISources): ISinks {
  const dom = sources.dom;
  const resetClick$ = dom.select("#resetButton")
    .events("click")
    .map(ev =&gt; 0)
    .startWith(0)

  const button1Click$ = dom.select("#button1")
    .events("click")
    .compose(dropUntil(resetClick$.last()))
    .map(ev =&gt; 1)
    .fold((acc, n) =&gt; acc + n, 0)
    .startWith(0)

  const button2Click$ = dom.select("#button2")
    .events("click")
    .compose(dropUntil(resetClick$.last()))
    .map(ev =&gt; 1)
    .fold((acc, n) =&gt; acc + n, 0)
    .startWith(0)

  const vtree$ = Stream.combine(button1Click$, button2Click$)
    .map(n =&gt;
      div([
        input("#button1", { attrs: { type: "button", value: "Click Me!"}}),
        input("#button2", { attrs: { type: "button", value: "Click Me!"}}),
        input("#resetButton", { attrs: { type: "button", value: "Reset!"}}),
        p(["Clicks: " + n[0] + " + " + n[1]]),
        p(["Click total: " + (n[0] + n[1])])
      ])
    )

  const sinks: ISinks = {
    dom: vtree$
  };
  return sinks;
}
</code></pre>