1.1.1 • Published 1 year ago

reactjs-gyroscope v1.1.1

Weekly downloads
-
License
LGPL
Repository
github
Last release
1 year ago

reactjs-gyroscope

This package allows to read gyroscope data Gyroscope.

Installation

yarn add reactjs-gyroscope

Usage

import { useEffect, useState } from 'react'
import { getGyroscope, gyroscopePermission } from 'reactjs-gyroscope';

function App() {
  const [start, setStart] = useState(false);

  useEffect(() => {
    if (start) {
      getGyroscope((event) => {
        console.log(event)
      });
    }
  }, [start]);

  return (<>
    <button onClick={() => {
      gyroscopePermission().then(response => {
        if (response) {
          setStart(true);
        }
      });
    }}>Start</button>
  </>);
}

export default App;

Notes

Needs permission for deviceorientation event. (a.k.a. only using HTTPS).

License

LGPL-3.0

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago