events

@ObjCName(swiftName = "events")
fun events(): SharedFlow<MonitorEvent>

Hot stream of MonitorEvents — every schedule, dispatch, deferral, completion, retry, cancellation, and library-internal error the scheduler observes.

Swift sees this as AsyncSequence<MonitorEvent> via SKIE. Iterate with for await event in backgrounder.events() { switch onEnum(of: event) { … } } for exhaustive case handling.

Semantics. Hot, non-replaying — late collectors do not see history. Backed by a MutableSharedFlow(replay = 0, extraBufferCapacity = 64, onBufferOverflow = DROP_OLDEST); sustained back-pressure drops the oldest unread events first. Emit is non-suspending so a slow collector cannot pin scheduler dispatch (CLAUDE.md §3).

For the imperative callback alternative covering the four v1 events only, see BackgrounderEventListener. Both channels are fed from the same internal emit point and stay in lockstep.