aboutsummaryrefslogtreecommitdiff
path: root/test/playground/monaco.gleam
blob: f0927ca3aee985298965c3b08dda6329a923754d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)
    })
}