Skip to content

PluginLifecycleEventPayload

The payload of PLUGIN_LOADED_EVENT_NAME and PLUGIN_UNLOADED_EVENT_NAME.

Plain data by design — no class instances and no types owned by this library — because it crosses between independently bundled copies of it, and between plugins that do not use it at all.

Import:

import type { PluginLifecycleEventPayload } from 'obsidian-dev-utils/obsidian/plugin/plugin-lifecycle-events';

Signature:

export interface PluginLifecycleEventPayload

Properties

PropertyTypeDescription
apiVersionsreadonly string[]The contract versions the plugin published, empty when it publishes no API.

An array rather than a single version because a provider may publish several contract versions side by side, so consumers pinned to an older range keep working across a breaking change.

The API objects themselves are deliberately NOT here. A handle delivered by a one-shot event is a probe: it answers "now" and never says when "now" changed, and one that outlives the provider is exactly the stale handle the plugin-api registry's revocable handles exist to prevent. Reach the API through watchPluginApi instead, whose reference stays correct across unload and re-enable.
dependencyPluginIdsreadonly string[]The ids of the plugins this one declares as mandatory dependencies, empty when it declares none.

Present so the relationship can be read from the OTHER end: a provider has no way to ask who depends on it — the registry only answers consumer-to-provider — and "which installed plugins need this one" is what lets a provider's settings tab tell the user why it is in their vault at all.
pluginIdstringThe plugin's manifest.id.
pluginNamestringThe plugin's manifest.name, for display.
pluginVersionstringThe plugin's manifest.version.

Links to this page: