Skip to content

Commit

Permalink
✨ Add destroyed() to Sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
RustySnek committed Oct 8, 2023
1 parent 2962817 commit 309414c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("
let Hooks = {}
Hooks.Sortable = {
mounted() {
let sorter = new Sortable(this.el, {
this.sorter = new Sortable(this.el, {
group: this.el.dataset.group,
animation: 150,
delay: 0,
Expand All @@ -39,7 +39,11 @@ Hooks.Sortable = {
this.pushEventTo(this.el, "reposition", params)
}
})
},
destroyed() {
this.sorter.destroy()
}

}
let liveSocket = new LiveSocket("/live", Socket, { params: { _csrf_token: csrfToken }, hooks: Hooks })

Expand Down

0 comments on commit 309414c

Please sign in to comment.