diff --git a/package.json b/package.json index 55cc795..35c6767 100644 --- a/package.json +++ b/package.json @@ -22,15 +22,15 @@ "cookie-parser": "^1.4.3", "express": "^4.13.3", "jwt-simple": "^0.5.1", - "lodash": "^4.11.2", + "lodash": "^4.17.3", "marked": "^0.3.5", "moment": "^2.11.0", "mongoose": "^4.3.3", "nconf": "^0.8.4", - "pico-flux": "^1.1.0", + "pico-flux": "^2.0.0", "pico-router": "^1.1.0", - "react": "^15.0.2", - "react-dom": "^15.0.2", + "react": "^15.4.1", + "react-dom": "^15.4.1", "shortid": "^2.2.4", "striptags": "^2.1.1", "superagent": "^1.6.1", diff --git a/shared/naturalcrit/brew.actions.js b/shared/naturalcrit/brew.actions.js new file mode 100644 index 0000000..25f57eb --- /dev/null +++ b/shared/naturalcrit/brew.actions.js @@ -0,0 +1,15 @@ +const dispatch = require('pico-flux').dispatch; + +const Actions = { + addInc : (val = 1) => { + dispatch('ADD_INC', val); + }, + delayInc : (val = 1) => { + dispatch('DELAY_INC', val) + }, + setInc : (newInc) => { + dispatch('SET_INC', newInc); + }, +}; + +module.exports = Actions; \ No newline at end of file diff --git a/shared/naturalcrit/brew.store.js b/shared/naturalcrit/brew.store.js new file mode 100644 index 0000000..9af6e68 --- /dev/null +++ b/shared/naturalcrit/brew.store.js @@ -0,0 +1,31 @@ +const _ = require('lodash'); +const flux = require('pico-flux'); + +let State = { + count : 0 +}; + +const Store = flux.createStore({ + INC : (val) => { + State.count += val; + }, + + SET_INC : (val) => { + State.count = val; + return false; + }, + + DELAY_INC : (val) => { + setTimeout(()=>{ + State.count += val; + Store.emitChange(); + }, 2000); + return false; + } +}); + +Store.getCount = ()=>{ + return State.count; +}; + +module.exports = Store; \ No newline at end of file