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

Commit f157ce7

Browse files
committed
Fix #4
1 parent 20f11b9 commit f157ce7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.install = function (Vue) {
1616
// determine event type
1717
var event = this.arg
1818
var recognizerType, recognizer
19-
19+
2020
if (customeEvents[event]) { // custom event
2121

2222
var custom = customeEvents[event]
@@ -67,7 +67,7 @@ exports.install = function (Vue) {
6767

6868
unbind: function () {
6969
this.mc.off(this.arg, this.handler)
70-
if (!this.mc.handlers.length) {
70+
if (!objectLength(this.mc.handlers)) {
7171
this.mc.destroy()
7272
this.el.hammer = null
7373
}
@@ -92,4 +92,10 @@ exports.registerCustomEvent = function (event, options) {
9292

9393
function capitalize (str) {
9494
return str.charAt(0).toUpperCase() + str.slice(1)
95+
}
96+
97+
function objectLength(obj) {
98+
var length = 0;
99+
for (var key in obj) if (obj.hasOwnProperty(key)) length++;
100+
return length
95101
}

0 commit comments

Comments
 (0)