To add double tap in JJS, the usual approach is to detect two taps within a short time window and then trigger a separate action for the second tap. Public examples for double-tap handling use a dedicated double-tap handler, often alongside a normal tap handler, so the logic is based on timing and distance between taps.

Basic idea

  1. Store the time of the last tap.
  2. Check whether the next tap happens quickly enough, usually within a small delay.
  3. If it does, treat it as a double tap.
  4. Otherwise, treat it as a single tap after the timeout passes.

This matches how common double-tap systems work: first tap starts a timer, second tap within the interval fires the double-tap action.

Simple pattern

A basic JavaScript-style pattern looks like this:

js

let lastTap = 0;
const delay = 300;

function handleTap() {
  const now = Date.now();
  if (now - lastTap < delay) {
    doubleTapAction();
    lastTap = 0;
  } else {
    lastTap = now;
    setTimeout(() => {
      if (Date.now() - lastTap >= delay) {
        singleTapAction();
      }
    }, delay);
  }
}

That structure is consistent with double-tap detection examples used in touch and mouse event handlers.

If JJS means a game script

If you mean a JJS moveset or combat script, the double tap usually becomes a combo input or a second activation state rather than a browser gesture. In that case, you would:

  • track the first input,
  • open a short input window,
  • trigger the alternate move if the same input happens again,
  • reset the state after the timeout.

That is similar in principle to combo/multi-step input logic used in other gesture systems and game input handlers.

Practical version

  • Use a short delay like 250–350 ms.
  • Ignore taps that are too far apart.
  • Reset the counter after the window ends.
  • Keep the single-tap action from firing too early if a double tap is possible.

If you want, I can turn this into a JJS-style script example for your exact setup.