Prettier formatting

This commit is contained in:
Fred Boniface
2023-07-07 11:27:28 +01:00
parent 039b57efe7
commit 7dc24646b9
49 changed files with 2796 additions and 2419 deletions

View File

@@ -1,29 +1,28 @@
import { writable } from 'svelte/store'
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
export const ql = writable(fromLocalStorage('ql', []))
export const ql = writable(fromLocalStorage('ql', []));
toLocalStorage(ql, 'ql');
function fromLocalStorage(storageKey, fallback) {
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined' && storedValue !== null) {
return (typeof fallback === 'object')
? JSON.parse(storedValue)
: storedValue
}
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined' && storedValue !== null) {
return typeof fallback === 'object'
? JSON.parse(storedValue)
: storedValue;
}
return fallback
}
return fallback;
}
function toLocalStorage(store, storageKey) {
if (browser) {
store.subscribe(value => {
let storageValue = (typeof value === 'object')
? JSON.stringify(value)
: value
if (browser) {
store.subscribe((value) => {
let storageValue =
typeof value === 'object' ? JSON.stringify(value) : value;
localStorage.setItem(storageKey, storageValue)
})
}
}
localStorage.setItem(storageKey, storageValue);
});
}
}

View File

@@ -1,23 +1,23 @@
import { writable } from 'svelte/store'
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
export const uuid = writable(fromLocalStorage('uuid', null))
export const uuid = writable(fromLocalStorage('uuid', null));
toLocalStorage(uuid, 'uuid');
function fromLocalStorage(storageKey, fallback) {
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined') {
return storedValue
}
if (browser) {
const storedValue = localStorage.getItem(storageKey);
if (storedValue !== 'undefined') {
return storedValue;
}
return fallback
}
return fallback;
}
function toLocalStorage(store, storageKey) {
if (browser) {
store.subscribe(value => {
localStorage.setItem(storageKey, value)
})
}
}
if (browser) {
store.subscribe((value) => {
localStorage.setItem(storageKey, value);
});
}
}