Events and Reactivity
This part covers the event system and the reactive features: events, subscriptions, event pipelines, and more.
EventsAn event declares a broadcast channel: one emit and every subscriber receives the payload in turn. An event can live at module top level or on a type, where it becomes an instance event.
Subscription Handles and Event ValuesEvery subscription produces a subscription handle, and an event name in value position produces an event value. The handle covers unsubscribing and stats; the event value covers passing a channel around as data.
Awaiting Eventsawait <event source> suspends the current frame inside an async function until the event's next firing, then returns the payload. The wait is essentially a one-shot subscription: it resumes on firing, and resuming deregisters it. It produces no subscription handle and does not interfere with ~> subscriptions.
Event PipelinesAn event declaration can carry three pipeline segments — before / after / finally — writing the "around the emit" rules into the channel itself: before can rewrite the payload or cancel the dispatch, after runs after dispatch, and finally runs unconditionally.
ReactiveReactivity centers on the computed derived read: each read computes from the current dependencies, and when a dependency changes the value follows automatically. bind then turns "source changes → target gets written" into a single declaration.
AnimationAn animated prop declares a read-only property that approaches a target value over time: the source expression gives the target, the easing function and the duration give the path. The value you read is the intermediate value interpolated at the current moment — when the source changes, the value does not jump right over; it converges across the duration.
Last updated on October 11, 2026
