From 8d05b2dea4afc46a03dc12e26d7b37d45140eaf9 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Sat, 19 Aug 2023 22:40:55 +0100 Subject: :sparkles: Allow starting args to be passed to an app's init function on start. --- lib/test/examples/nested.gleam | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/test/examples/nested.gleam') diff --git a/lib/test/examples/nested.gleam b/lib/test/examples/nested.gleam index 47bb9d5..91c2da4 100644 --- a/lib/test/examples/nested.gleam +++ b/lib/test/examples/nested.gleam @@ -14,8 +14,8 @@ pub fn main() { // A `simple` lustre application doesn't produce `Effect`s. These are best to // start with if you're just getting started with lustre or you know you don't // need the runtime to manage any side effects. - let app = lustre.simple(init, update, render) - let assert Ok(_) = lustre.start(app, "[data-lustre-app]") + let app = lustre.simple(init, update, view) + let assert Ok(_) = lustre.start(app, "[data-lustre-app]", Nil) Nil } @@ -25,10 +25,10 @@ pub fn main() { type Model = Map(Int, counter.Model) -fn init() -> Model { +fn init(_) -> Model { use counters, id <- list.fold(list.range(1, 10), map.new()) - map.insert(counters, id, counter.init()) + map.insert(counters, id, counter.init(Nil)) } // UPDATE ---------------------------------------------------------------------- @@ -45,10 +45,10 @@ fn update(model: Model, msg: Msg) -> Model { // RENDER ---------------------------------------------------------------------- -fn render(model: Model) -> Element(Msg) { +fn view(model: Model) -> Element(Msg) { let counters = { use rest, id, counter <- map.fold(model, []) - let el = element.map(counter.render(counter), pair.new(id, _)) + let el = element.map(counter.view(counter), pair.new(id, _)) [el, ..rest] } -- cgit v1.2.3