Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function connect(options = {}) {
const id = generateId(options.instanceId);
const opts = {
...options,
instanceId: id,
name: options.name || id,
actionCreators: JSON.stringify(getActionsArray(options.actionCreators || {})),
};
start();
return {
init(state, action) {
send(action || {}, state, 'INIT', opts);
},
subscribe(listener) {
if (!listener) return undefined;
if (!listeners[id]) listeners[id] = [];
listeners[id].push(listener);
shouldHotReload,
shouldRecordChanges,
shouldStartLocked,
pauseActionType = '@@PAUSED',
actionCreators,
filters,
actionsBlacklist,
actionsWhitelist,
actionSanitizer,
stateSanitizer,
deserializeState,
deserializeAction,
serialize,
predicate,
} = options;
const id = generateId(options.instanceId);
const serializeState = getSeralizeParameter(options, 'serializeState');
const serializeAction = getSeralizeParameter(options, 'serializeAction');
return next => (reducer, initialState) => {
const store = configureStore(next, monitorReducer, {
maxAge,
shouldCatchErrors,
shouldHotReload,
shouldRecordChanges,
shouldStartLocked,
pauseActionType,
})(reducer, initialState);
instances[id] = {
name: name || id,
const compose = options => (...funcs) => (...args) => {
const instanceId = generateId(options.instanceId);
return [preEnhancer(instanceId), ...funcs].reduceRight(
(composed, f) => f(composed),
devToolsEnhancer({ ...options, instanceId })(...args)
);
};