cocopon / tweakpane

:control_knobs: Compact GUI for fine-tuning parameters and monitoring value changes
https://tweakpane.github.io/docs/
MIT License
3.44k stars 86 forks source link

[Plugin question] how to teardown listener or timer in plugin, if tweakpane is been removed #208

Closed hirohe closed 3 years ago

hirohe commented 3 years ago

thanks for the tweakpane plugin system, i'm try to write some extensions

if i using setTimeout in plugin for debounce purpose.

than i need to call clearTimeout if tweakpane removed. but i don't know if there has destroy or depose callback for plugin

cocopon commented 3 years ago

Great, you may be a first plugin developer (except me)!

i don't know if there has destroy or depose callback for plugin

Ah, I missed that functionality. I'll add it in the next release so please wait.

cocopon commented 3 years ago

Added support for onDispose() of a plugin controller and a view. Please refer the latest diff of the template: https://github.com/cocopon/tweakpane-plugin-template/commit/1da991608b4d9dd4222f1225e263d2a5a2f93687

cocopon commented 3 years ago

oops, I have to implement recursive disposing of container (e.g. folder) items... trying to fix it.

cocopon commented 3 years ago

Fixed the issue, and now pane.dispose() triggers disposing sub items correctly. Please try the latest version 2.1.6.