diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2022-05-22 03:46:24 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2022-05-22 03:46:24 +0100 |
commit | af7c2e44f3bb3e52cea363c4188a39fc1924931f (patch) | |
tree | 3d6747c9f63d2221e453718b1dd41ea824f0987e /test/playground/monaco.gleam | |
parent | d408e6b8bd47b8c5ac5d2218943c11d576705583 (diff) | |
download | lustre-af7c2e44f3bb3e52cea363c4188a39fc1924931f.tar.gz lustre-af7c2e44f3bb3e52cea363c4188a39fc1924931f.zip |
:construction: Experiment using monaco editor for the lustre playground.
Diffstat (limited to 'test/playground/monaco.gleam')
-rw-r--r-- | test/playground/monaco.gleam | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/playground/monaco.gleam b/test/playground/monaco.gleam new file mode 100644 index 0000000..f0927ca --- /dev/null +++ b/test/playground/monaco.gleam @@ -0,0 +1,15 @@ +import gleam/dynamic +import lustre/attribute.{ Attribute } +import lustre/element.{ Element } +import lustre/event + +pub external fn render (attributes: List(Attribute(action))) -> Element(action) + = "../playground.mjs" "monaco" + +pub fn on_change (handler: fn (String, fn (action) -> Nil) -> Nil) -> Attribute(action) { + event.on("change", fn (e, dispatch) { + assert Ok(code) = dynamic.string(e) + + handler(code, dispatch) + }) +}
\ No newline at end of file |