From c96139b5c6027a1a68ab41667f8d3a9874c1ea71 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Wed, 21 Feb 2024 22:52:18 +0000 Subject: :memo: Add a slightly more detailed explainer on events. --- docs/guide/01-quickstart.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/guide/01-quickstart.md b/docs/guide/01-quickstart.md index b678175..f8723a7 100644 --- a/docs/guide/01-quickstart.md +++ b/docs/guide/01-quickstart.md @@ -201,6 +201,15 @@ pub fn view(model: Model) -> lustre.Element(Msg) { } ``` +The above snippet attaches two click event listeners that produce an `Increment` +or `Decrement` message when clicked. The Lustre runtime is responsible for +attaching these event listeners and calling your `update` function with the +resulting message. + +**Note**: notice that the return type of `view` is `lustre.Element(Msg)`. The +type parameter `Msg` tells us the kinds of messages this element might produce +from events: type safety to the rescue! + This forms the core of every Lustre application: - A model produces some view. -- cgit v1.2.3