aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-06-11 18:57:35 +0100
committerHayleigh Thompson <me@hayleigh.dev>2024-06-11 18:57:35 +0100
commit23506897a2a0862a3563a0c24894a20c962167ad (patch)
tree89d3b01a3d938ca97e69e0e1172088883c2615e4 /src
parent13505d08a0665dff3802d9c10e62bb57428d6999 (diff)
downloadlustre-23506897a2a0862a3563a0c24894a20c962167ad.tar.gz
lustre-23506897a2a0862a3563a0c24894a20c962167ad.zip
:memo: Mark effect.event as internal.
Diffstat (limited to 'src')
-rw-r--r--src/lustre/effect.gleam11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lustre/effect.gleam b/src/lustre/effect.gleam
index fdb96f9..4295ef9 100644
--- a/src/lustre/effect.gleam
+++ b/src/lustre/effect.gleam
@@ -73,14 +73,11 @@ pub fn from(effect: fn(fn(msg) -> Nil) -> Nil) -> Effect(msg) {
}
/// Emit a custom event from a component as an effect. Parents can listen to these
-/// events in their `view` function like any other HTML event.
-///
-/// You *probably* don't need to use this type of effect if you're not making use
-/// of Lustre's components, but in rare cases it may be useful to emit custom
-/// events from the DOM node that your Lustre application is mounted to.
-///
-///
+/// events in their `view` function like any other HTML event. Any data you pass
+/// to `effect.emit` can be accessed by event listeners through the `detail` property
+/// of the event object.
///
+@internal
pub fn event(name: String, data: Json) -> Effect(msg) {
Effect([fn(_, emit) { emit(name, data) }])
}