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

Method apply

packages/dva-core/src/Plugin.js:54–72  ·  view source on GitHub ↗
(key, defaultHandler)

Source from the content-addressed store, hash-verified

52 }
53
54 apply(key, defaultHandler) {
55 const hooks = this.hooks;
56 const validApplyHooks = ['onError', 'onHmr'];
57 invariant(
58 validApplyHooks.indexOf(key) > -1,
59 `plugin.apply: hook ${key} cannot be applied`
60 );
61 const fns = hooks[key];
62
63 return (...args) => {
64 if (fns.length) {
65 for (const fn of fns) {
66 fn(...args);
67 }
68 } else if (defaultHandler) {
69 defaultHandler(...args);
70 }
71 };
72 }
73
74 get(key) {
75 const hooks = this.hooks;

Callers 5

startFunction · 0.80
plugin.test.jsFile · 0.80
onErrorFunction · 0.80
startFunction · 0.80
startFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected