blob: 6b7f7f7bde1895c52f15bfa1f0fe6797cd6fb143 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import gleam/io
import lustre
import lustre/attribute.{ Attribute, attribute }
import lustre/element.{ Element }
import playground/monaco
pub type Action {
OnInput(String)
}
pub fn main () {
let init = "// Write some Gleam code here"
let update = fn (_, action) {
case action {
OnInput(input) ->
io.debug(input)
}
}
let render = fn (state) {
monaco.render([
attribute("value", state),
monaco.on_change(fn (code, dispatch) {
dispatch(OnInput(code))
})
])
}
lustre.simple(init, update, render)
|> lustre.start("[data-lustre-container]")
}
|