@consumidor-positivo/ts-utils - v1.34.0
    Preparing search index...

    Function useSecretTap

    • A hook that returns a tap handler which fires onTrigger after taps consecutive taps, as long as each tap happens within resetMs of the previous one. Useful for hidden debug/QA gestures.

      Parameters

      • onTrigger: () => void

        Function to call once the required number of consecutive taps is reached

      • options: UseSecretTapOptions = {}

        Configuration options

      Returns () => void

      A memoized tap handler to attach to an element's event (e.g. onClick)

      import { useSecretTap } from '@consumidor-positivo/ts-utils/react';

      function AppHeader() {
      const handleSecretTap = useSecretTap(() => {
      console.log('Debug menu unlocked!');
      }, { taps: 7, resetMs: 1000 });

      return <h1 onClick={handleSecretTap}>My App</h1>;
      }