0

I am new to React and Flux. I am trying to build a subscription like system. With many to many relation ship but i am confused on how to implement the callback:

The scenario:

User a, b, c subscribe to item 1.

User a, b, d subscribe to item 2.

User b, c, d subscribe to item 3.

the items are infinite, and the users are also infinite.

So in this case, if there is some attribute in item 1 changed, I want to emit change to the its subscriber which is a,b,c.

Due to the fact the items are infinite, I can't manually create a that number of callbacks.

I imagine there would be an array of callback that bind to the subscribers. And only have 1 emit change, then find the callback index, and perform the callback to its subscribers.

Could someone point me to the correct direction.

Thanks,

LanNguyen
  • 234
  • 3
  • 15
  • You can create a single callback and send item and/or user as a parameter to the callback function. – maxx777 Apr 26 '15 at 09:18
  • I don't think that would be a solution, I believe flux is unidirectional, data can be sent back, the user has to go to the store to get the data. correct me if I am wrong – LanNguyen Apr 26 '15 at 17:03

0 Answers0