I'm developing an application using React + Flux. In the example in facebook chat, it uses node EventEmitter
to trigger events. However, as I know jQuery can also do pub/sub jobs too, using $(ele).trigger
.
Is there any difference between the two? Will performance come into play as well?
I don't think there's any significant difference between the two for the purposes of Flux. In fact, you can even use standalone event emitters to produce the same result (there are a lot of different ones).
However, for the sake of development it's probably wise to use node's EventEmitter because it's the most commonly used and endorsed by Facebook, so you're less likely to run into any unforeseen issues. The source code eventEmitter in node is pretty light... it's more likely that you'd see worse performance from using the jQuery trigger anyway.