aboutsummaryrefslogtreecommitdiff
path: root/examples/06-custom-effects/src/app.ffi.mjs
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-01-31 22:20:46 +0000
committerHayleigh Thompson <me@hayleigh.dev>2024-01-31 22:20:46 +0000
commite68be4621a154c1c3d533ab160b29cbb404e50fe (patch)
treeedff9e6266587aa97784a44f3f950d1087be8d04 /examples/06-custom-effects/src/app.ffi.mjs
parentff321580a14ba0ef38beaa9ce92df212f6729f83 (diff)
downloadlustre-e68be4621a154c1c3d533ab160b29cbb404e50fe.tar.gz
lustre-e68be4621a154c1c3d533ab160b29cbb404e50fe.zip
:construction: Start writing an example for custom effects.
Diffstat (limited to 'examples/06-custom-effects/src/app.ffi.mjs')
-rw-r--r--examples/06-custom-effects/src/app.ffi.mjs11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/06-custom-effects/src/app.ffi.mjs b/examples/06-custom-effects/src/app.ffi.mjs
new file mode 100644
index 0000000..c401b99
--- /dev/null
+++ b/examples/06-custom-effects/src/app.ffi.mjs
@@ -0,0 +1,11 @@
+import { Ok, Error } from "./gleam.mjs";
+
+export function read_localstorage(key) {
+ const value = window.localStorage.getItem(key);
+
+ return value ? new Ok(value) : new Error(undefined);
+}
+
+export function write_localstorage(key, value) {
+ window.localStorage.setItem(key, value);
+}