Documentation / @finchart/core / index / pluginApi
Function: pluginApi()
pluginApi<
T>(api,dispose):T&PluginApi
Defined in: packages/core/src/primitives/plugin.ts:90
Grafts lifecycle onto an API that already has its own methods. Returns the same object — use preserves identity, so this doesn't create a new one either.
ts
return pluginApi({ node }, () => handle.dispose());This exists to replace a spread ({ ...teardown(fn), node }) — a spread copies the disposed accessor's value at that instant (false), producing an API that claims to be alive forever, even after cleanup.
Type Parameters
T
T extends object
Parameters
api
T
dispose
() => void
Returns
T & PluginApi