flux-common-store
Flux Common Store
Installation
npm install --save-dev flux-common-store
API
CHANGE_EVENT
(change)
Constant event name, equals change
emitChange()
Emits CHANGE_EVENT
addChangeListener(callback)
: unsubscribeFunction
Adds callback
listener for CHANGE_EVENT and returns unsubscribe
function
removeChangeListener(callback)
Alternative way to unsubscribe from CHANGE_EVENT.
WARN For safety reasons, use unsubscribe
function returned by addChangeListener
instead
Usage
./stores/TodoStore.js
;;; let todos = {}; const create = { const id = Date; todosid = id: id complete: false text: text;}; const destroy = delete todosid; const TodoStore = ...FluxCommonStore { return todos; }; TodoStoredispatcherIndex = Dispatcher; ;
./components/TodoApp.js
; const TodoApp = React; ;
License
MIT