MCPcopy Index your code
hub / github.com/MALSync/MALSync / init

Function init

src/_minimal/utils/state.ts:48–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47init();
48async function init() {
49 const cache = new Cache('stateContext', 14 * 24 * 60 * 60 * 1000);
50 if (await cache.hasValue()) {
51 const curContext = await cache.getValue();
52 if (curContext.stateContext) setStateContext(curContext.stateContext);
53 if (curContext.typeContext) setTypeContext(curContext.typeContext);
54 }
55 watch([typeContext, stateContext], () => {
56 cache.setValue({
57 stateContext: stateContext.value,
58 typeContext: typeContext.value,
59 });
60 });
61}
62
63export function getUrlObj() {
64 return JSON.parse(localStore.getItem(STORAGE_KEY) || 'null');

Callers 1

state.tsFile · 0.70

Calls 5

hasValueMethod · 0.95
getValueMethod · 0.95
setValueMethod · 0.95
setStateContextFunction · 0.85
setTypeContextFunction · 0.85

Tested by

no test coverage detected