Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combine doesn't handle queued events in the correct order #8

Open
dyoder opened this issue Aug 17, 2015 · 0 comments
Open

combine doesn't handle queued events in the correct order #8

dyoder opened this issue Aug 17, 2015 · 0 comments

Comments

@dyoder
Copy link
Member

dyoder commented Aug 17, 2015

The test currently passes, but if we queue the events, it fails. This code illustrates the problem:

    click =
      increment: new EventEmitter
      decrement: new EventEmitter

    i = flow [
      events "change", click.increment
      map -> 1
    ]

    j = flow [
      events "change", click.decrement
      map -> -1
    ]

    k = flow [
      combine i, j
      accumulate ((a, b) -> a + b), 0
    ]

    # inc, dec
    click.increment.emit "change"
    assert (yield next k).value == 1
    click.decrement.emit "change"
    assert (yield next k).value == 0
    click.increment.emit "change"
    click.decrement.emit "change"
    click.increment.emit "change"
    assert (yield next k).value == 1
    assert (yield next k).value == 2
    assert (yield next k).value == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant