To read the full documentation for this module, please visit


pub opaque type Effect(msg)


pub fn batch(effects: List(Effect(a))) -> Effect(a)
pub fn event(name: String, data: a) -> Effect(b)

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.

pub fn from(effect: fn(fn(a) -> Nil) -> Nil) -> Effect(a)
pub fn map(effect: Effect(a), f: fn(a) -> b) -> Effect(b)
pub fn none() -> Effect(a)

Typically our app’s update function needs to return a tuple of #(model, Effect(msg)). When we don’t need to perform any side effects we can just return none()!

Search Document