import Hammer from "hammerjs";

export function singleOrDoubleTapRecognizer(element) {
  // reference: https://codepen.io/jtangelder/pen/xxYyJQ
  const hm = new Hammer.Manager(element);

  hm.add(new Hammer.Tap({ event: "doubletap", taps: 2 }));
  hm.add(new Hammer.Tap({ event: "singletap" }));

  hm.get("doubletap").recognizeWith("singletap");
  hm.get("singletap").requireFailure("doubletap");
  return hm;
}
