(0, _reactRedux.connect)(function (state, props) { var payload = state.get(props.name); return { payload: payload || (0, _immutable.Map)() }; }, function (dispatch) { return _objectSpread({}, (0, _redux.bindActionCreators)(actions, dispatch)); }, null, { //withRef: true, pure: true })(AppLoader)
function init(option) { (0, _config.default)(option); var currentConfig = _config.default.current; if (currentConfig.apps) _appFactory.default.registerApps(currentConfig.apps); var mw = [(0, _appMiddleware.default)(currentConfig.actionInjections || {}, currentConfig.reducerInjections || {})]; if (currentConfig.middlewares) mw = mw.concat(currentConfig.middlewares); var store = (0, _redux.createStore)(_reducer.default, (0, _immutable.Map)(), _redux.applyMiddleware.apply(void 0, (0, _toConsumableArray2.default)(mw))); globalObj.reduxStore = store; globalObj.__maka_store__ = store; return store; }
export function getPermissionsSucceeded(data) { const permissions = Map(fromJS(data.permissions)); return { type: GET_PERMISSIONS_SUCCEEDED, permissions, }; }
static getList(): Map<string, ItemType> { let data: Object = JSON.parse(String(localStorage.getItem(listKey))); let state: Map<string, ItemType> = fromJS(data, (key, value) => { return key === '' ? value.toMap() : ItemFactory(value); }); return state ? state.sortBy(item => item.name) : Map(); }
let combineImmutableReducers = reducers => { var combined_reducers = combineReducers(reducers); return (state,action) => Map(combined_reducers( Map.isMap(state) ? state.toObject() : state,action )); }
describe('store test',()=>{ it('redux store configured with the correct reducer',()=>{ const store =makeStore(); expect(store.getState()).to.equal(Map()); store.dispatch({ type:'SET_ENTRIES',entries:['Trainspotting','28 days later'] }); expect(store.getState()).to.equal(fromJS({ entries:['Trainspotting','28 days later'] })); }); });
export function formatAuthorsForDisplay(immtblAuthors, fieldMap = {id: 'id', fullName: 'fullName'}) { if (!immtblAuthors || !Immutable.Iterable.isIterable(immtblAuthors)) { return; } return immtblAuthors.map(author => { return Map().withMutations(o => { o.set(fieldMap.id, author.get('id')); o.set(fieldMap.fullName, author.get('firstName') + ' ' + author.get('lastName')); }); }); }
export default function(state = Map(), action) { switch(action.type){ case 'SET_STATE': return resetVote(setState(state, action.state)); case 'VOTE': return vote(state, action.entry); } return state; }
constructor(name, state, reactions) { super(); this.state = Map(state); this.reactions = reactions; this.dispatchName = turnToDispatchName(name) + '_STORE_CHANGE'; this.dispatchToken = Dispatcher.register((action) => this.__mapDispatchActions(name, action)); }
export default function(state = Map(), action) { switch(action.type) { case 'SET_STATE': return setState(state, action.state); case 'INCREMENT_COUNT': return incrementCount(state); case 'DECREMENT_COUNT': return decrementCount(state); } return state; }
(0, _reactRedux.connect)(function (state, props) { var payload = state.get(props.name); return { payload: payload || (0, _immutable.Map)() }; }, function (dispatch) { return (0, _objectSpread2.default)({}, (0, _redux.bindActionCreators)(actions, dispatch)); }, null, { //withRef: true, pure: true })(AppLoader)
export default function reducer(state, action) { state = state || Map(); // TODO Define actions as strings switch(action.type) { // CASE 'ACTION_STRING': // return pureFunction(); } // Return current state if action wasn't handled return state; }
static getState(): Map<string, Record<Object>> { let data: Object = JSON.parse(String(localStorage.getItem(key))); let state: Map<string, Record<Object>> = fromJS(data, (key, value) => { return key === '' ? value.toMap() : new Item(value); }); return state ? state.sortBy(item => item.name) : Map(); }
function init(option) { (0, _config.default)(option); var currentConfig = _config.default.current; if (currentConfig.apps) _appFactory.default.registerApps(currentConfig.apps); var mw = [(0, _appMiddleware.default)(currentConfig.actionInjections || {}, currentConfig.reducerInjections || {})]; if (currentConfig.middlewares) mw = mw.concat(currentConfig.middlewares); var store = (0, _redux.createStore)(_reducer.default, (0, _immutable.Map)(), _redux.applyMiddleware.apply(void 0, (0, _toConsumableArray2.default)(mw))); window.reduxStore = store; window.__maka_store__ = store; }