This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Description
There's a part of code in your unbind hook that's never being called
Here's entire block of code.
unbind: function () {
if (this.handler) {
this.mc.off(this.arg, this.handler)
}
if (!Object.keys(this.mc.handlers).length) {
this.mc.destroy()
this.el.hammer = null
}
}
this.mc.handlers is Object having each handler bound in key : [value] fassion
this.mc.off(this.arg, this.handler) does not remove handler from this object, instead it sets its value to empty array.
That would mean that following lines:
if (!Object.keys(this.mc.handlers).length) {
this.mc.destroy()
this.el.hammer = null
}
Never gets called since !Object.keys(this.mc.handlers).length always remain the same and that is total number of handlers that were bound to an element in the first place.
Better way to do it would be:
var handlers = this.mc.handlers
if (!Object.keys(handlers).filter(h => handlers[h].length).length) {
this.mc.destroy()
this.el.hammer = null
}