Is calling .destory() necessary? #7952
Unanswered
michaeladamkatz
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I call
let mySwiper = new Swiper( myContainer, ... )
, my understanding is that swiperjs adds a bunch to the DOM inside myContainer, and I get back a swiper object, which I store in some variable or data structure.I'm trying to understand if I need to call
mySwiper.destory()
when I'm done with it, or if it's enough to empty themyContainer
DOM div and give up the reference to the swiper object, like withmySwiper = null
.I looked at the code for
destroy()
and saw a lot of removal of event handlers and such, but by removing the contents ofmyContainer
from the DOM and giving up my reference to the swiper objects, doesn't it all get cleaned up through garbage collection anyway?Beta Was this translation helpful? Give feedback.
All reactions