Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 678 Bytes

useButtonChange.md

File metadata and controls

27 lines (20 loc) · 678 Bytes

Run the passed callback function on any gamepad button update including touch and value.

Example

import useButtonChange from 'react-ctrls/useButtonChange';

const MyComponent = () => {
  useButtonChange((data) => {
    console.log(data);
  });

  return <div>...</div>;
};

Event Data Type

interface IGamepadEventData {
  gamepad: Gamepad;
  index: number;
  value: number;
}

Refer to mappings to target buttons on various gamepads.