Understanding the Reflux API – Actions Hooks


Action hooks are called before the action’s event gets emitted.

  • preEmit
  • shouldEmit

could be used. shouldEmit can control whether or not to emit the event before it actually gets called. It’s probably going to be pretty handy when you want to throttle events. Let’s see it in action by using it in the previous sample I posted.

preEmit is just logging what kind of arguments it received. shouldEmit on the other hand, controls whether or not to emit the event. In this case, the load action emits an event only if the Load Success button is pressed.

Check it out on my JSBin

Written on August 5, 2015