A simple utility to manage and request browser permissions seamlessly. This package provides an easy-to-use API for handling permissions like notifications, geolocation, camera, microphone, and more.
- ✅ Check the current permission status for various browser APIs.
- 🔄 Request permissions dynamically.
- 📢 Handle permission changes efficiently.
- 🎯 Lightweight and easy to integrate.
npm install browser-permissions-helper
or
yarn add browser-permissions-helper
import { PermissionType, checkPermission, requestPermission } from 'browser-permissions-helper';
const status = await checkPermission(PermissionType.Geolocation);
console.log(`Geolocation permission: ${status}`);
const result = await requestPermission(PermissionType.Notifications);
console.log(`Notification permission granted: ${result}`);
geolocation
clipboard-write
notifications
camera
microphone
camera-advanced
speaker-selection
bluetooth
midi
nfc
screen-wake-lock
persistent-storage
push
idle-detection
storage-access
display-capture
window-management
Checks the current status of a given permission.
Requests the specified permission from the user and returns true
if granted, otherwise false
.
This package works in modern browsers that support the Permissions API.
Browser | Supported |
---|---|
Chrome | ✅ Yes |
Firefox | ✅ Yes |
Edge | ✅ Yes |
Safari | ✅ Partial (Some permissions may not be available) |
Contributions are welcome! Feel free to fork the repository, create a feature branch, and submit a PR.
This project is licensed under the MIT License.
For any queries or issues, please open an issue.
⭐ If you find this package useful, consider giving it a star on GitHub! ⭐