From 7a0e2daad1bdff63e202a38cbca9da6dc6b51849 Mon Sep 17 00:00:00 2001 From: Artem Chebotarev Date: Sun, 25 Nov 2018 17:35:18 +0200 Subject: [PATCH] add requireFailure for custom events --- index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.js b/index.js index 53dc189..f1d0016 100644 --- a/index.js +++ b/index.js @@ -46,6 +46,17 @@ export const VueHammer = { recognizer = new Hammer[this.capitalize(recognizerType)](custom) recognizer.recognizeWith(mc.recognizers) mc.add(recognizer) + + // add requireFailure for custom event + if (custom.requireFailure) { + let requiredFailures = mc.recognizers.filter( + recognizerItem => + custom.requireFailure.includes(recognizerItem.options.event) + ); + requiredFailures.forEach( + requiredFailure => recognizer.requireFailure(requiredFailure) + ) + } } else { // built-in event recognizerType = gestures.find(gesture => gesture === event)