mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-25 16:25:13 +00:00
必要な時以外はストレージを更新しない
This commit is contained in:
parent
40abe3d907
commit
54bf280874
1 changed files with 4 additions and 2 deletions
|
@ -80,8 +80,10 @@ export class Storage<T extends StateDef> {
|
|||
this.reactiveState[key].value = value;
|
||||
|
||||
const cache = JSON.parse(localStorage.getItem(this.keyForLocalStorage + '::cache::' + $i.id) || '{}');
|
||||
cache[key] = value;
|
||||
localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache));
|
||||
if (cache[key] !== value) {
|
||||
cache[key] = value;
|
||||
localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue