4.1.5 • Published 4 months ago

browser-permissions-helper v4.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Browser Permissions Helper

browser-permission-helper-banner.png

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.

šŸš€ Features

  • āœ… Check the current permission status for various browser APIs.
  • šŸ”„ Request permissions dynamically.
  • šŸ“¢ Handle permission changes efficiently.
  • šŸŽÆ Lightweight and easy to integrate.

šŸ“¦ Installation

npm install browser-permissions-helper

or

yarn add browser-permissions-helper

šŸ›  Usage

Import the Module

import { PermissionType, checkPermission, requestPermission } from 'browser-permissions-helper';

Check Permission Status

const status = await checkPermission(PermissionType.Geolocation);
console.log(`Geolocation permission: ${status}`);

Request Permission

const result = await requestPermission(PermissionType.Notifications);
console.log(`Notification permission granted: ${result}`);

šŸ“œ Supported Permissions

  • 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

šŸ“– API Reference

checkPermission(permissionType: PermissionType) => Promise<'granted' | 'denied' | 'prompt'>

Checks the current status of a given permission.

requestPermission(permissionType: PermissionType) => Promise<boolean>

Requests the specified permission from the user and returns true if granted, otherwise false.

šŸ›”ļø Browser Compatibility

This package works in modern browsers that support the Permissions API.

BrowserSupported
Chromeāœ… Yes
Firefoxāœ… Yes
Edgeāœ… Yes
Safariāœ… Partial (Some permissions may not be available)

šŸ¤ Contributing

Contributions are welcome! Feel free to fork the repository, create a feature branch, and submit a PR.

šŸ“œ License

This project is licensed under the MIT License.

šŸ“¬ Contact

For any queries or issues, please open an issue.


⭐ If you find this package useful, consider giving it a star on GitHub! ⭐

4.1.3

4 months ago

4.1.5

4 months ago

4.0.9

4 months ago

4.0.7

4 months ago

4.0.6

5 months ago

4.0.4

5 months ago

4.0.2

5 months ago

4.0.1

5 months ago

3.0.7

5 months ago

3.0.6

5 months ago

3.0.5

5 months ago

3.0.4

5 months ago

3.0.3

5 months ago

3.0.2

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago