Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

๐Ÿ”— ๐Ÿ—บ๏ธ React hook which checks if the user has provided permissions to a given API.

License

Notifications You must be signed in to change notification settings

JamesIves/react-use-navigator-permissions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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.

About

๐Ÿ”— ๐Ÿ—บ๏ธ React hook which checks if the user has provided permissions to a given API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published