MCPcopy
hub / github.com/iChochy/NCE / getStorage

Function getStorage

js/utils/storage.js:14–22  ·  view source on GitHub ↗
(key, defaultValue = null)

Source from the content-addressed store, hash-verified

12 * @returns {*} 存储的值或默认值
13 */
14export function getStorage(key, defaultValue = null) {
15 try {
16 const item = localStorage.getItem(key);
17 return item !== null ? item : defaultValue;
18 } catch (error) {
19 console.error(`Failed to read from storage (${key}):`, error);
20 return defaultValue;
21 }
22}
23
24/**
25 * 从 localStorage 读取 JSON 数据

Callers 9

applyBookFromHashMethod · 0.90
loadSavedSpeedMethod · 0.90
detectThemeMethod · 0.90
getStorageJSONFunction · 0.85
getPlayTimeFunction · 0.85
getCurrentUnitIndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected