Skip to content

Commit

Permalink
Swiper.destroy - fix for multi invocation of detachEvents() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Triloworld committed Apr 25, 2018
1 parent e04796c commit 44ec90a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/components/core/core-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ class Swiper extends SwiperClass {
destroy(deleteInstance = true, cleanStyles = true) {
let swiper = this;
const { params, $el, $wrapperEl, slides } = swiper;

if(typeof swiper.params === 'undefined'){
return true
}

swiper.emit('beforeDestroy');

// Init Flag
Expand Down
4 changes: 0 additions & 4 deletions src/components/core/events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ function detachEvents() {

const { params, touchEvents, el, wrapperEl } = swiper;

if(typeof params === 'undefined'){
return true
}

const target = params.touchEventsTarget === 'container' ? el : wrapperEl;
const capture = !!params.nested;

Expand Down

0 comments on commit 44ec90a

Please sign in to comment.