Skip to content

Documentation / @finchart/core / PluginApi

Interface: PluginApi

Defined in: packages/core/src/plot/plugin.ts:23

플러그인이 돌려주는 것.

dispose는 여러 번 불려도 안전해야 한다 — 무대의 destroy()가 설치한 것을 전부 정리하는데, 사용자가 이미 손으로 정리했을 수 있기 때문이다.

disposed가 계약인 이유는 셋이다: ⑴ 죽은 API를 무대가 놓아준다(안 그러면 토글마다 클로저가 쌓인다) ⑵ 플러그인이 자기 정리 뒤의 호출을 막는다 ⑶ 생명주기 상태를 밖에서 관측할 수 있다.

직접 구현하지 말고 teardown·pluginApi를 쓴다 — 특히 스프레드로 합치지 않는다({ ...teardown(fn), add }). 스프레드는 접근자를 그 순간의 값으로 복사해서 disposed가 영영 false로 굳는다.

Extended by

Properties

disposed

readonly disposed: boolean

Defined in: packages/core/src/plot/plugin.ts:25

Methods

dispose()

dispose(): void

Defined in: packages/core/src/plot/plugin.ts:24

Returns

void