aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/utilities/persistent-store.ts
diff options
context:
space:
mode:
authoriv-ar <i@oiee.no>2023-03-04 16:54:16 +0100
committeriv-ar <i@oiee.no>2023-03-04 16:54:16 +0100
commitcf546fd4b9a1fbf77bccf5f0b713e688d29a66ad (patch)
tree8103d953afec0618a55dc957ba8a3222dac0e842 /code/app/src/utilities/persistent-store.ts
parentb85164718d3bd6a4ad5fc06d04a3ce2dc028b1db (diff)
downloadgreatoffice-cf546fd4b9a1fbf77bccf5f0b713e688d29a66ad.tar.xz
greatoffice-cf546fd4b9a1fbf77bccf5f0b713e688d29a66ad.zip
feat: Use console to log
Diffstat (limited to 'code/app/src/utilities/persistent-store.ts')
-rw-r--r--code/app/src/utilities/persistent-store.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/code/app/src/utilities/persistent-store.ts b/code/app/src/utilities/persistent-store.ts
index 3f56312..d880464 100644
--- a/code/app/src/utilities/persistent-store.ts
+++ b/code/app/src/utilities/persistent-store.ts
@@ -1,7 +1,6 @@
-import { browser } from "$app/environment";
-import { writable as _writable, readable as _readable } from "svelte/store";
-import type { Writable, Readable, StartStopNotifier } from "svelte/store";
-import { log_debug, log_info } from "./logger";
+import {browser} from "$app/environment";
+import {writable as _writable, readable as _readable} from "svelte/store";
+import type {Writable, Readable, StartStopNotifier} from "svelte/store";
enum StoreType {
SESSION = 0,
@@ -53,7 +52,7 @@ function get_store_value<T>(init: WritableStoreInit<T> | ReadableStoreInit<T>):
return JSON.parse(value);
} catch (e) {
console.error(e);
- return { __INVALID__: true };
+ return {__INVALID__: true};
}
}
@@ -73,11 +72,11 @@ function subscribe<T>(store: Writable<T> | Readable<T>, init: WritableStoreInit<
function create_writable_persistent<T>(init: WritableStoreInit<T>): Writable<T> {
if (!browser) {
- log_info("WARN: Persistent store is only available in the browser");
+ console.warn("Persistent store is only available in the browser");
return;
}
if (init.options === undefined) throw new Error("init is a required parameter");
- log_debug("creating writable store with options: ", init);
+ console.debug("Creating writable store with options: ", init);
const store = _writable<T>(init.initialState);
hydrate(store, init);
subscribe(store, init);
@@ -86,11 +85,11 @@ function create_writable_persistent<T>(init: WritableStoreInit<T>): Writable<T>
function create_readable_persistent<T>(init: ReadableStoreInit<T>): Readable<T> {
if (!browser) {
- log_info("WARN: Persistent store is only available in the browser");
+ console.warning("Persistent store is only available in the browser");
return;
}
if (init.options === undefined) throw new Error("init is a required parameter");
- log_debug("Creating readable store with options: ", init);
+ console.debug("Creating readable store with options: ", init);
const store = _readable<T>(init.initialState, init.callback);
// hydrate(store, options);
subscribe(store, init);