diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2024-01-31 22:20:46 +0000 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2024-01-31 22:20:46 +0000 |
commit | e68be4621a154c1c3d533ab160b29cbb404e50fe (patch) | |
tree | edff9e6266587aa97784a44f3f950d1087be8d04 /examples/06-custom-effects/src/app.ffi.mjs | |
parent | ff321580a14ba0ef38beaa9ce92df212f6729f83 (diff) | |
download | lustre-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.mjs | 11 |
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); +} |