reflux / reflux-core

A simple core library for uni-directional dataflow application architecture inspired by ReactJS Flux
BSD 3-Clause "New" or "Revised" License
48 stars 19 forks source link

Feature request: PublisherMethods.listenOnce ? #7

Closed sairion closed 9 years ago

sairion commented 9 years ago

I have some use case which join* methods can't cover.

For example, I have action1 and action2 and want to trigger when both actions get emitted. This is surely get covered by join* methods. But when action2 is an { action | store } which gets called very often over the lifecycle, it does not work like what I expect.

I would like to just use listenOnce type of method inside action1. this is more sounds like a workaround, but it could have more use case I think.

sairion commented 9 years ago

Nevermind, I did not know PublisherMethods.listen() returns unsubscribe function. I ended up writing something like this:

var stop = store.listen(payload => { doWith(payload); stop(); });