MCPcopy
hub / github.com/nhn/tui.chart / setModule

Method setModule

apps/chart/src/store/store.ts:95–130  ·  view source on GitHub ↗
(name: string | StoreModule, param?: StoreOptions | StoreModule)

Source from the content-addressed store, hash-verified

93 }
94
95 setModule(name: string | StoreModule, param?: StoreOptions | StoreModule) {
96 if (!param) {
97 param = name as StoreModule;
98 name = (param as StoreModule).name;
99 }
100
101 if (param.state) {
102 const moduleState =
103 typeof param.state === 'function' ? param.state(this.initStoreState) : param.state;
104 extend(this.state, moduleState);
105 }
106
107 if (param.computed) {
108 forEach(param.computed, (item, key) => {
109 this.setComputed(key, item);
110 });
111 }
112
113 if (param.watch) {
114 forEach(param.watch, (item, key) => {
115 this.setWatch(key, item);
116 });
117 }
118
119 if (param.action) {
120 forEach(param.action, (item, key) => {
121 this.setAction(key, item);
122 });
123 }
124
125 if (param.observe) {
126 forEach(param.observe, (item) => {
127 this.observe(item);
128 });
129 }
130 }
131
132 setValue(target: Record<string, any>, key: string, source: Record<string, any>) {
133 extend(target, {

Callers 2

initStoreFunction · 0.45
store.spec.tsFile · 0.45

Calls 6

setComputedMethod · 0.95
setWatchMethod · 0.95
setActionMethod · 0.95
observeMethod · 0.95
extendFunction · 0.90
forEachFunction · 0.90

Tested by

no test coverage detected