From e68be4621a154c1c3d533ab160b29cbb404e50fe Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Wed, 31 Jan 2024 22:20:46 +0000 Subject: :construction: Start writing an example for custom effects. --- examples/06-custom-effects/src/app.ffi.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 examples/06-custom-effects/src/app.ffi.mjs (limited to 'examples/06-custom-effects/src/app.ffi.mjs') 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); +} -- cgit v1.2.3