I am using BaconJS to create two event streams likes this:
# Wait for start of the module
sStart = Bacon.fromCallback module.onStart.bind(module)
# Watch game ticks
sTick = Bacon.fromEventTarget emitter, 'tick'
# Combine it to do something
Bacon.onValues sStart, sTick, ->
# Do something on each tick, but only when module has been started
I want to use it for synchronization. Once the module is started, it should start listening for ticks, not sooner. It almost works, but the callback is invoked for all past ticks that has been emitted before module start instead of just recent one. Than I want to that callback being invoked for each following tick.
I am pretty much starting with FRP, there is probably some elegant way how to deal with it, but I just don't see it for now. Any ideas ?