Skip to content

events

Typed helpers for subscribing to an Obsidian Events source. Both derive the valid event names and their callback argument types from the source’s overloaded on method (via ExtractEventMap), so the event name and handler are fully autocompleted. subscribeEvent returns the raw EventRef (parity with Events.on); subscribeDisposableEvent returns a DisposableEx that unregisters it.

Class Description
EventRefDisposable A DisposableEx that unregisters an Obsidian EventRef on dispose, via the event source exposed on the ref itself (eventRef.e).
Interface Description
SubscribeEventParams Parameters for subscribeEvent.
Function Description
subscribeDisposableEvent Subscribes to an event on an Events source and returns a DisposableEx that unregisters it on dispose. Typed wrapper over Events.on: the event name and callback arguments are autocompleted from the source’s overloads.
subscribeEvent Subscribes to an event on an Events source and returns the raw EventRef (parity with Events.on). Typed wrapper: the event name and callback arguments are autocompleted from the source’s overloads.
Type Description
SubscribeDisposableEventParams Parameters for subscribeDisposableEvent. Same shape as SubscribeEventParams.