Skip to content

obsidian/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.

ClassDescription
EventRefDisposableA DisposableEx that unregisters an Obsidian EventRef on dispose, via the event source exposed on the ref itself (eventRef.e).
InterfaceDescription
SubscribeEventParamsParameters for subscribeEvent.
FunctionDescription
subscribeDisposableEventSubscribes 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.
subscribeEventSubscribes 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.
TypeDescription
SubscribeDisposableEventParamsParameters for subscribeDisposableEvent. Same shape as SubscribeEventParams.