Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 495 Bytes

useAxisChange.md

File metadata and controls

27 lines (20 loc) · 495 Bytes

Run the passed callback function on any gamepad axis update.

Example

import useAxisChange from 'react-ctrls/useAxisChange';

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

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

Event Data Type

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

Refer to mappings to target axes on various gamepads.