MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / _set

Method _set

src/pkg/config/config.ts:192–211  ·  view source on GitHub ↗
(key: T, value: SystemConfigValueType<T> | undefined)

Source from the content-addressed store, hash-verified

190 }
191
192 private _set<T extends SystemConfigKey>(key: T, value: SystemConfigValueType<T> | undefined) {
193 const prev = this.cache.get(key);
194 const storage = this.getStorage(key);
195 let asyncOp;
196 if (value === undefined) {
197 this.cache.delete(key);
198 asyncOp = storage.remove(key);
199 } else {
200 this.cache.set(key, value);
201 asyncOp = storage.set(key, value);
202 }
203 asyncOp.then(() => {
204 // 发送消息通知更新
205 this.mq.publish<TKeyValue<T>>(SystemConfigChange, {
206 key,
207 value,
208 prev,
209 });
210 });
211 }
212
213 defaultCheckScriptUpdateCycle() {
214 return 86400;

Callers 15

setEnableAutoSyncMethod · 0.95
setVscodeUrlMethod · 0.95
setVscodeReconnectMethod · 0.95
setBackupMethod · 0.95
setCloudSyncMethod · 0.95
setCatFileStorageMethod · 0.95
setEnableEslintMethod · 0.95
setEslintConfigMethod · 0.95
setEditorConfigMethod · 0.95

Calls 6

getStorageMethod · 0.95
getMethod · 0.65
deleteMethod · 0.65
removeMethod · 0.65
setMethod · 0.65
publishMethod · 0.65

Tested by

no test coverage detected