@talend/react-cmf
Version:
A framework built on top of best react libraries
25 lines (23 loc) • 767 B
JavaScript
/**
* This module provide helpers to use redux-saga in the CMF context
* @module react-cmf/lib/saga
* @example
import cmf from '@talend/react-cmf';
cmf.saga.putActionCreator('myaction', {}, {});
*/
import { put, select } from 'redux-saga/effects';
import actionCreatorAPI from '../actionCreator';
import registry from '../registry';
function* putActionCreator(actionCreatorId, event, data, optContext) {
const state = yield select();
const context = optContext || {
registry: registry.getRegistry(),
store: {
getState: () => state
}
};
const actionCreator = actionCreatorAPI.get(context, actionCreatorId);
yield put(actionCreator(event, data, context));
}
export default putActionCreator;
//# sourceMappingURL=putActionCreator.js.map