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

Destroy Method #33

Closed
maimairel opened this issue May 19, 2014 · 7 comments
Closed

Destroy Method #33

maimairel opened this issue May 19, 2014 · 7 comments

Comments

@maimairel
Copy link

Hi, great plugin :)

What I'm missing right now is the functionality to destroy a switchery instance. Is it enough to just remove the DOM element, or does such a functionality already exists?

Thank you!

@abpetkov
Copy link
Owner

I haven't made that currently, but my intentions are to make it happen soon, since it's not that complex to do.

@maimairel
Copy link
Author

Thank you! Looking forward to it :)

@infacq
Copy link

infacq commented Jun 26, 2014

1+

@abpetkov
Copy link
Owner

abpetkov commented Mar 9, 2015

@maimairel I think that post and it's accepted answer pretty much sums up that it's enough to set all the instances to null and probably delete the DOM object to get rid of the instance, instead of trying to really delete it, which appears to be impossible.

@abpetkov abpetkov closed this as completed Mar 9, 2015
@maimairel
Copy link
Author

@abpetkov Yes, setting it to null or undefined will make the object a candidate for garbage collection, but we need a destroy method to be sure that all event handlers bound by the plugin are removed, otherwise it won't be garbage collected.

@abpetkov abpetkov reopened this Mar 30, 2015
@abpetkov
Copy link
Owner

abpetkov commented Apr 1, 2015

@maimairel I will make a new release until the end of the week, but I've pushed some changes to the master branch. Some of them include the .destroy() method you can use on the object reference to unbind all events attached to it. Please take a look if possible and LMK what you think.

@abpetkov
Copy link
Owner

abpetkov commented Apr 3, 2015

Released in 0.8.0

@abpetkov abpetkov closed this as completed Apr 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants