ngx-check-permission
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Visit beforepost.com for awesome color palettes & extract colors and text from any source

Welcome to ngx-check-permission!

Live preview

Check live preview

CDN

CDN Link for ngx-check-permission- https://unpkg.com/ngx-check-permission@0.0.8/bundles/ngx-check-permission.umd.js

Permissions info

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

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',

CDN

CDN Link for ngx-check-permission- https://unpkg.com/ngx-check-permission@0.0.3/bundles/ngx-check-permission.umd.js

Angular version

This library was generated with Angular CLI version 13.0.0.

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.

Author

Thanks in advance

Manojkumar Muthukumar

Coimbatore

Visit beforepost.com for awesome color palettes & extract colors and text from any source

Install

npm i ngx-check-permission

DownloadsWeekly Downloads

36

Version

0.1.0

License

MIT

Unpacked Size

42.1 kB

Total Files

16

Last publish

Collaborators

  • manoj10101996