aboutsummaryrefslogtreecommitdiff
path: root/test/playground/monaco.gleam
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2022-05-22 03:46:24 +0100
committerHayleigh Thompson <me@hayleigh.dev>2022-05-22 03:46:24 +0100
commitaf7c2e44f3bb3e52cea363c4188a39fc1924931f (patch)
tree3d6747c9f63d2221e453718b1dd41ea824f0987e /test/playground/monaco.gleam
parentd408e6b8bd47b8c5ac5d2218943c11d576705583 (diff)
downloadlustre-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.gleam15
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