From 10bc93f41efdd9aab25e1e0d29b02b3b961158c5 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Thu, 27 Apr 2023 21:52:15 +0100 Subject: :bookmark: Code for 3.0.0-rc.1 --- src/lustre.gleam | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/lustre.gleam') diff --git a/src/lustre.gleam b/src/lustre.gleam index bdf6225..54f6c55 100644 --- a/src/lustre.gleam +++ b/src/lustre.gleam @@ -4,7 +4,7 @@ import lustre/cmd.{Cmd} import lustre/element.{Element} -import gleam/result +import gleam/javascript/promise.{Promise} // TYPES ----------------------------------------------------------------------- @@ -242,16 +242,12 @@ pub fn application( /// function from your `main` (or elsewhere) you can get events into your Lustre /// app from the outside world. /// -pub fn start( - app: App(model, msg), - selector: String, -) -> Result(fn(msg) -> Nil, Error) { +pub fn start(app: App(model, msg), selector: String) -> Promise(fn(msg) -> Nil) { mount(app, selector) - |> result.replace_error(ElementNotFound) } external fn mount( app: App(model, msg), selector: String, -) -> Result(fn(msg) -> Nil, Nil) = - "./ffi.mjs" "mount" +) -> Promise(fn(msg) -> Nil) = + "./lustre.ffi.mjs" "mount" -- cgit v1.2.3