GitXplorerGitXplorer
J

react-use-navigator-permissions

public
4 stars
2 forks
2 issues

Commits

List of commits on branch main.
Verified
a3bb91c374fd0b1e61b7e6d2f5bec74037dc018a

docs: prep for archive

JJamesIves committed 2 years ago
Unverified
77a290140e9244c6b01e406e563bf15e5968b7f3

Update index.tsx

JJamesIves committed 5 years ago
Unverified
cce09a01ca4c4a531d312180d5df6f1a79b1ca60

Formatting

JJamesIves committed 5 years ago
Unverified
d4aed5bd8ff108e3db09ace1ca86e5c44d417fd8

Simplifying things

JJamesIves committed 5 years ago
Unverified
daa0b5800426ff2d16771984a176ba6e007fe89e

Merge branch 'master' of https://github.com/JamesIves/react-use-navigator-permissions

JJamesIves committed 5 years ago
Unverified
bae3d4cc1bf539cb235b96abfee77346858c35bb

Update package.json

JJamesIves committed 5 years ago

README

The README file for this repository.

useNavigatorPermissions Hook πŸ”— πŸ—ΊοΈ

This React Hook allows you to make a query to see if a user has either accepted or denied permissions to a given navigator api.

Getting Started ✈️

You can install this hook using Yarn.

yarn add react-use-navigator-permissions

It can then be included in your project like so.

import useNavigatorPermissions from 'react-use-navigator-permissions'

const Component = () => {
  const { status, error } = useNavigatorPermissions('geolocation')

  return (
    <div>{status}</div>
  )
}

The first argument accepts the api name, and the second accepts a series of configuration parameters.

Browser Compatibility πŸ“£

This hook utilizes window.navigator.permissions which is not widely supported by all browsers. For information on what browser supports what please refer to the documentation.