diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-14 19:56:34 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2023-07-14 19:56:34 +0100 |
commit | 7d068ba4515763da9ce644b489192aa9ed32fc0a (patch) | |
tree | 55beb730322633bda82c68796a7cca27d867fbb9 /src/lustre.gleam | |
parent | 19d6bcffb8eda0f2b6069d3505e2ec67a4d51455 (diff) | |
download | lustre-7d068ba4515763da9ce644b489192aa9ed32fc0a.tar.gz lustre-7d068ba4515763da9ce644b489192aa9ed32fc0a.zip |
:recycle: Upgrade syntax for Gleam v0.30
Diffstat (limited to 'src/lustre.gleam')
-rw-r--r-- | src/lustre.gleam | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/lustre.gleam b/src/lustre.gleam index 073d03b..1628a33 100644 --- a/src/lustre.gleam +++ b/src/lustre.gleam @@ -49,7 +49,7 @@ import lustre/element.{Element} /// <small>Someone please PR the Gleam docs generator to fix the monospace font, /// thanks! 💖</small> /// -pub external type App(model, msg) +pub type App(model, msg) pub type Error { ElementNotFound @@ -202,12 +202,11 @@ pub fn simple( /// external fn set_timeout (f: fn () -> a, delay: Int) -> Nil /// = "" "window.setTimeout" ///``` -pub external fn application( - init: fn() -> #(model, Cmd(msg)), - update: Update(model, msg), - render: Render(model, msg), -) -> App(model, msg) = - "./lustre.ffi.mjs" "setup" +@external(javascript, "./lustre.ffi.mjs", "setup") +pub fn application(init init: fn() -> #(model, Cmd(msg)), update update: Update( + model, + msg, + ), render render: Render(model, msg)) -> App(model, msg) // EFFECTS --------------------------------------------------------------------- @@ -243,8 +242,8 @@ pub fn start( |> result.replace_error(ElementNotFound) } -external fn start_( - app: App(model, msg), - selector: String, -) -> Result(fn(msg) -> Nil, Nil) = - "./lustre.ffi.mjs" "start" +@external(javascript, "./lustre.ffi.mjs", "start") +fn start_(app app: App(model, msg), selector selector: String) -> Result( + fn(msg) -> Nil, + Nil, +) |