Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-check-permission

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-check-permission

Angular library which checks the permission status and returns the permission status for the following api's .push, midi, camera, microphone, speaker, device-info, background-fetch, background-sync, bluetooth, persistent-storage, ambient-light-sensor, acc

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
increased by168.75%
Maintainers
1
Weekly downloads
 
Created
Source

Permissions info

Angular library which provides device permission status which are allowed for current device / system.



Import

Import the module on your app.module.ts file as follow.

import { NgxCheckPermissionModule } from 'ngx-check-permission';

Then import the module as follow on imports array

NgxCheckPermissionModule

Using service

Import the servie to appropriate component / service file as follows.

import { NgxCheckPermissionService } from 'ngx-check-permission';
constructor( public permission: NgxCheckPermissionService ) {}

Permissions

Getting all the permission status is async process use async function in order to receive the response

async ngOnInit() {
    await this.checkPermissions();
}

public async checkPermissions() {
    await this.permission.getAllPermissions().then((permisssions) => {
	    console.log(permisssions);
    });
}

Sample response

[{
	"permissionName": "geolocation",
	"state": "prompt"
}, {
	"permissionName": "notifications",
	"state": "prompt"
}, {
	"permissionName": "midi",
	"state": "granted"
}, {
	"permissionName": "camera",
	"state": "prompt"
}, {
	"permissionName": "microphone",
	"state": "prompt"
}, {
	"permissionName": "background-fetch",
	"state": "granted"
}, {
	"permissionName": "background-sync",
	"state": "granted"
}, {
	"permissionName": "persistent-storage",
	"state": "prompt"
}, {
	"permissionName": "accelerometer",
	"state": "granted"
}, {
	"permissionName": "gyroscope",
	"state": "granted"
}, {
	"permissionName": "magnetometer",
	"state": "granted"
}, {
	"permissionName": "display-capture",
	"state": "prompt"
}]

Permission list:

'geolocation', 'notifications', 'push', 'midi', 'camera', 'microphone', 'speaker', 'device-info', 'background-fetch', 'background-sync', 'bluetooth', 'persistent-storage', 'ambient-light-sensor', 'accelerometer', 'gyroscope', 'magnetometer', 'clipboard', 'display-capture', 'nfc'

Code integration

To use this package as a service npm i ngx-check-permission install this on the root angular project .

Note: Don't forget to run this commend npm i ngx-check-permission on root folder or else it will throw error.



Keywords

FAQs

Package last updated on 13 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc