Fork me on GitHub

Hey, is there a way to change a variable in a go loop once it's starts running? Trying to change a var in a loop via a subscription but it sticks with the values it was intialized with.


Hi all: what is the best way to schedule a fn to run once after all events have been handled, but before all subscriptions have been synced?


im not sure what all subs have been synced means but maybe you want


Without more context, you can have 1 event to manipulate whatever data you're transforming dispatching into the fn you want to run as a side effect. And then have that event dispatch into setting your state.


@tavistock, @pcj, thanks for the response! More specifically: the reaction/subscription graph is batch updated via requestAnimationFrame, and I'm wondering if there's a way to hook into that to have a fn run before all the subscriptions are updated. There's next-tick, which does exactly that, but that is a one time thing. I could just set up recursive call to next-tick, but haven't seen that as a design pattern anywhere, so I was checking if there's some established way of scheduling something to run regularly.


Dispatching to another event is a great suggestion, but this is not app state related, and it was something I specifically wanted to do before the reaction/subscription graph updated, but after all events have been processed in the queue.