PublishPluginApiParams<TApi>
Parameters for publishPluginApi.
Import:
import type { PublishPluginApiParams } from '@mnaoumov/obsidian-lib/plugin/plugin-api';Signature:
export interface PublishPluginApiParams<TApi extends object> extends PluginApiDeclaration<TApi>Extends: PluginApiDeclaration<TApi>
Properties
| Property | Type | Description |
|---|---|---|
| api | TApi | The API object to publish. Its methods are handed to consumers through a revocable handle, and they are always invoked with this object as their this, so an implementation using private class fields keeps working.(Inherited from PluginApiDeclaration) |
| apiVersion | string | The CONTRACT version, in semver form — independent of the plugin's own version. Plugin 1.4.7 may perfectly well expose API 2.0.0.(Inherited from PluginApiDeclaration) |
| component? | Component | The component whose unload revokes the record. Defaults to PublishPluginApiParams.plugin, which is the right owner for an API published for as long as the plugin runs. Pass a narrower one when the API is only valid for part of the plugin's life — a plugin whose feature surface is torn down and rebuilt while the plugin itself stays loaded must revoke with the surface, or it leaves consumers holding handles into code that is no longer there. |
| contract? | ApiContract<TApi> | The contract this version of the API satisfies. Optional: when omitted, no shape check is performed on the provider's behalf and the consumer's own contract (if any) is used instead. (Inherited from PluginApiDeclaration) |
| plugin | Plugin | The publishing plugin. The record is keyed by its manifest.id and revoked automatically when the plugin unloads, via plugin.register(). |
Links to this page: