(subs, model, app, onError)
| 3 | import prefixedDispatch from './prefixedDispatch'; |
| 4 | |
| 5 | export function run(subs, model, app, onError) { |
| 6 | const funcs = []; |
| 7 | const nonFuncs = []; |
| 8 | for (const key in subs) { |
| 9 | if (Object.prototype.hasOwnProperty.call(subs, key)) { |
| 10 | const sub = subs[key]; |
| 11 | const unlistener = sub({ |
| 12 | dispatch: prefixedDispatch(app._store.dispatch, model), |
| 13 | history: app._history, |
| 14 | }, onError); |
| 15 | if (isFunction(unlistener)) { |
| 16 | funcs.push(unlistener); |
| 17 | } else { |
| 18 | nonFuncs.push(key); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | return { funcs, nonFuncs }; |
| 23 | } |
| 24 | |
| 25 | export function unlisten(unlisteners, namespace) { |
| 26 | if (!unlisteners[namespace]) return; |
nothing calls this directly
no test coverage detected