Comparing version 1.0.2 to 1.1.0
{ | ||
"name": "vue-touch", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"main": "vue-touch.js", | ||
@@ -19,2 +19,3 @@ "files": [ | ||
"devDependencies": { | ||
"uglify-js": "^2.6.2", | ||
"vue": "^1.0.16", | ||
@@ -24,5 +25,5 @@ "webpack": "^1.12.12" | ||
"scripts": { | ||
"build": "webpack example/example.js example/example.build.js", | ||
"build": "webpack example/example.js example/example.build.js && uglifyjs vue-touch.js -c -m > vue-touch.min.js", | ||
"dev": "webpack --watch example/example.js example/example.build.js" | ||
} | ||
} |
@@ -8,4 +8,4 @@ ;(function () { | ||
var gestures = ['tap', 'pan', 'pinch', 'press', 'rotate', 'swipe'] | ||
var directions = ['up', 'down', 'left', 'right', 'horizontal', 'vertical'] | ||
var customeEvents = {} | ||
var directions = ['up', 'down', 'left', 'right', 'horizontal', 'vertical', 'all'] | ||
var customEvents = {} | ||
@@ -39,5 +39,5 @@ if (!Hammer) { | ||
if (customeEvents[event]) { | ||
if (customEvents[event]) { | ||
// custom event | ||
var custom = customeEvents[event] | ||
var custom = customEvents[event] | ||
recognizerType = custom.type | ||
@@ -87,3 +87,2 @@ recognizer = new Hammer[capitalize(recognizerType)](custom) | ||
var mc = this.mc | ||
var vm = this.vm | ||
var event = this.arg | ||
@@ -95,2 +94,3 @@ // teardown old handler | ||
if (typeof fn !== 'function') { | ||
this.handler = null | ||
console.warn( | ||
@@ -101,3 +101,3 @@ '[vue-touch] invalid handler function for v-touch: ' + | ||
} else { | ||
mc.on(event, fn) | ||
mc.on(event, (this.handler = fn)) | ||
} | ||
@@ -107,3 +107,5 @@ }, | ||
unbind: function () { | ||
this.mc.off(this.arg, this.handler) | ||
if (this.handler) { | ||
this.mc.off(this.arg, this.handler) | ||
} | ||
if (!Object.keys(this.mc.handlers).length) { | ||
@@ -140,3 +142,3 @@ this.mc.destroy() | ||
options.event = event | ||
customeEvents[event] = options | ||
customEvents[event] = options | ||
} | ||
@@ -151,4 +153,5 @@ | ||
if (typeof dir === 'string') { | ||
if (directions.indexOf(dir) > -1) { | ||
options.direction = Hammer['DIRECTION_' + dir.toUpperCase()] | ||
var hammerDirection = 'DIRECTION_' + dir.toUpperCase() | ||
if (directions.indexOf(dir) > -1 && Hammer.hasOwnProperty(hammerDirection)) { | ||
options.direction = Hammer[hammerDirection] | ||
} else { | ||
@@ -155,0 +158,0 @@ console.warn('[vue-touch] invalid direction: ' + dir) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147
5525
3
2
1
0