blob: 14958ace6da144a9571781ca48bab213dca41b32 (
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) {
let assert Ok(code) = dynamic.string(e)
handler(code, dispatch)
})
}
|