МА
Size: a a a
МА
AV
КК
МА
ab
ab
IS
МА
j
МА
IS
IS
const makeStorageProxy = (storage, key) => new Proxy(
{},
{
get(_, name) {
const currentState = JSON.parse(storage.getItem(key)) ?? {};
return currentState[name];
},
set(_, name, value) {
const currentState = JSON.parse(storage.getItem(key)) ?? {};
currentState[name] = value;
storage.setItem(key, JSON.stringify(currentState));
}
}
);
юзать так:const test = makeStorageProxy(localStorage, 'test');результат: https://t.me/js_noobs_ru/678926
test.test = 1;
test.testObj = { test: 1 };
IS
МА
МА
j
IS