in src/core/system.js [159:186]
getWrappedAndBoundActions(dispatch) {
let actionGroups = this.getBoundActions(dispatch)
return objMap(actionGroups, (actions, actionGroupName) => {
let wrappers = this.system.statePlugins[actionGroupName.slice(0,-7)].wrapActions
if(wrappers) {
return objMap(actions, (action, actionName) => {
let wrap = wrappers[actionName]
if(!wrap) {
return action
}
if(!Array.isArray(wrap)) {
wrap = [wrap]
}
return wrap.reduce((acc, fn) => {
let newAction = (...args) => {
return fn(acc, this.getSystem())(...args)
}
if(!isFn(newAction)) {
throw new TypeError("wrapActions needs to return a function that returns a new function (ie the wrapped action)")
}
return wrapWithTryCatch(newAction)
}, action || Function.prototype)
})
}
return actions
})
}