aboutsummaryrefslogtreecommitdiff
path: root/test/playground/monaco.gleam
diff options
context:
space:
mode:
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