1

I'm working on Chrome Extension using React.js and Reflux. Now I need to notify all parts of extension about changes when store is updated with one callback.

Something like:

function(newStore){
  chrome.runtime.sendMessage({action: 'updateStore', store: newStore});
}

Where is the point in Reflux for adding such callback?

Ladislav M
  • 2,157
  • 4
  • 36
  • 52

1 Answers1

3

I haven't built a chrome extension using Reflux but in general the pattern is to call:

store.listen(function(data) {
    // data is whatever your store invoked by saying this.trigger(...)
});

The callback function will be invoked whenever your store calls trigger with new data.

Bill D
  • 101
  • 3
  • I'm not sure I understand exactly what you're trying to do. Would you be able to provide some more code to show the different pieces of the whole? – Bill D Aug 25 '15 at 16:14