Skip to content

Instantly share code, notes, and snippets.

@travenasty
Created September 17, 2016 05:36
Show Gist options
  • Select an option

  • Save travenasty/b7bffe542165d437dfafe713c96f827d to your computer and use it in GitHub Desktop.

Select an option

Save travenasty/b7bffe542165d437dfafe713c96f827d to your computer and use it in GitHub Desktop.
Question about the nature of a merged stream used within an .endWhen
const orbRelease$ = xs.merge(
domCube.events('mouseout').filter(
ev => ev.target.classList.contains('au-cube')
),
domCube.events('mouseup'),
domCube.events('touchend')
).debug(log.pass)
const spin$ = dotTap$.map(tap => point$.endWhen(
// ONLY EMITS ONCE AND COMPLETES, UNLESS xs.merge IS INLINE HERE IT WILL REMAIN INCOMPLETE AND CONTINUE EMITTING
orbRelease$
)).flatten()
@travenasty
Copy link
Author

If I move the xs.merge(...) to be inline the .endWhen(...) the next instance of spin$ works as expected and endsWhen the mouse is released or exits the "cube". However with the code as shown, it will only emit the value the first time... and the second pass-through the spin$ stream will never complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment