diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2024-02-21 22:52:18 +0000 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2024-02-21 22:52:18 +0000 |
commit | c96139b5c6027a1a68ab41667f8d3a9874c1ea71 (patch) | |
tree | 22c4e6d595af004b85106d01ad20388c4207b543 | |
parent | ca3123aaba78cdaf30b0a775ddd0932db22c567f (diff) | |
download | lustre-c96139b5c6027a1a68ab41667f8d3a9874c1ea71.tar.gz lustre-c96139b5c6027a1a68ab41667f8d3a9874c1ea71.zip |
:memo: Add a slightly more detailed explainer on events.
-rw-r--r-- | docs/guide/01-quickstart.md | 9 |
1 files changed, 9 insertions, 0 deletions
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. |