1.3.1 • Published 5 years ago

@21kb/react-vibration-hook v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@21kb/react-vibration-hook

React hook to use the Vibration API

Install

npm

npm install --save @21kb/react-vibration-hook

Yarn

yarn add @21kb/react-vibration-hook

Usage

import useVibration from '@21kb/react-vibration-hook';

function Component() {
  const [vibrate, vibration] = useVibration();

  return (
    <div>
      <button onClick={() => vibrate()}>Vibrate for 200ms (the default)</button>
      <button onClick={() => vibrate(350)}>Vibrate for 350ms</button>
      <button onClick={() => vibrate([350, 200, 400, 200, 450, 200, 500])}>Vibrate for 350ms, then pause 200ms, and so on...</button>
    </div>
  )
}

License

MIT

1.3.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago