MCPcopy
hub / github.com/dvajs/dva / run

Function run

packages/dva-core/src/subscription.js:5–23  ·  view source on GitHub ↗
(subs, model, app, onError)

Source from the content-addressed store, hash-verified

3import prefixedDispatch from './prefixedDispatch';
4
5export 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
25export function unlisten(unlisteners, namespace) {
26 if (!unlisteners[namespace]) return;

Callers

nothing calls this directly

Calls 2

isFunctionFunction · 0.90
prefixedDispatchFunction · 0.85

Tested by

no test coverage detected