mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-08 14:03:53 +02:00
Use pretty json by default
This commit is contained in:
@@ -7,14 +7,9 @@
|
||||
let key;
|
||||
let value;
|
||||
|
||||
let store;
|
||||
let store = new LazyStore("cache.json");
|
||||
let cache = {};
|
||||
|
||||
function newStore() {
|
||||
store = new LazyStore("cache.json", { serializeFnName: "pretty-json" });
|
||||
}
|
||||
newStore()
|
||||
|
||||
async function refreshEntries() {
|
||||
try {
|
||||
const values = await store.entries();
|
||||
@@ -33,7 +28,11 @@
|
||||
|
||||
async function write(key, value) {
|
||||
try {
|
||||
await store.set(key, value);
|
||||
if (value) {
|
||||
await store.set(key, value);
|
||||
} else {
|
||||
await store.delete(key);
|
||||
}
|
||||
const v = await store.get(key);
|
||||
cache[key] = v;
|
||||
} catch (error) {
|
||||
@@ -60,7 +59,7 @@
|
||||
}
|
||||
|
||||
function reopen() {
|
||||
newStore()
|
||||
store = new LazyStore("cache.json");
|
||||
onMessage("We made a new `LazyStore` instance, operations will now work");
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user