Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove event listeners? #579

Closed
IvanLi-CN opened this issue Oct 29, 2023 · 3 comments
Closed

How to remove event listeners? #579

IvanLi-CN opened this issue Oct 29, 2023 · 3 comments

Comments

@IvanLi-CN
Copy link

Thanks to this project, I can easily add UI functionality.

Currently I use the following code to dynamically create and delete folders:

// add

this.pane.addFolder({
    expanded: this.getRememberedExpanded(),
    // ...
})
  .on("fold", (ev) => {
     this.setRememberedExpanded( ev.expanded );
  })

// remove

this.pane.dispose();

From time to time I would remove the old ones and add new ones to dynamically update the interface. But every time I remove and add, presumably the hander for the fold event is not released, resulting in a memory leak. Is there any way to perform an action like this.pane.off('fold')?

@cocopon
Copy link
Owner

cocopon commented Nov 10, 2023

It makes sense, and currently there is no method like .off(). I'll make sure to add it to my todo list.

cocopon added a commit that referenced this issue Dec 19, 2023
cocopon added a commit that referenced this issue Dec 19, 2023
@cocopon
Copy link
Owner

cocopon commented Dec 19, 2023

Implemented in #587. Please wait for the next release.

@cocopon
Copy link
Owner

cocopon commented Dec 22, 2023

Released 4.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants