Documentation / @finchart/core / pluginApi
Function: pluginApi()
pluginApi<
T>(api,dispose):T&PluginApi
Defined in: packages/core/src/plot/plugin.ts:81
자기 메서드를 가진 API에 생명주기를 심는다. 객체를 그대로 돌려준다 — use가 identity를 지키므로 여기서도 새 객체를 만들지 않는다.
ts
return pluginApi({ node }, () => handle.dispose());스프레드({ ...teardown(fn), node })를 대신하는 자리다 — 스프레드는 disposed 접근자를 그 순간의 값(false)으로 복사해 버려서, 정리한 뒤에도 영영 살아 있다고 답하는 API가 만들어진다.
Type Parameters
T
T extends object
Parameters
api
T
dispose
() => void
Returns
T & PluginApi