@therms/web-js
Advanced tools
Comparing version 2.3.2 to 2.3.3
@@ -0,1 +1,8 @@ | ||
## [2.3.3](https://bitbucket.org/thermsio/web-js/compare/v2.3.2...v2.3.3) (2022-07-13) | ||
### Bug Fixes | ||
* device permissions check update global obj ([78969e5](https://bitbucket.org/thermsio/web-js/commits/78969e576532bd2752674d8d15447b0db738aaa5)) | ||
## [2.3.2](https://bitbucket.org/thermsio/web-js/compare/v2.3.1...v2.3.2) (2022-07-13) | ||
@@ -2,0 +9,0 @@ |
@@ -461,3 +461,3 @@ 'use strict'; | ||
const permissionsState = { | ||
backgroundSync: 'prompt', | ||
'background-sync': 'prompt', | ||
bluetooth: 'prompt', | ||
@@ -475,5 +475,8 @@ camera: 'prompt', | ||
navigator.permissions | ||
.query(Object.assign({ name: permissionName }, descriptor)) | ||
.then(function (permission) { | ||
.query({ name: permissionName, ...descriptor }) | ||
.then((permission) => { | ||
// console.log(`${permissionName}: ${permission.state}`) | ||
// update the global obj when it's checked | ||
if (permissionsState[permissionName]) | ||
permissionsState[permissionName] = permission.state; | ||
switch (permission.state) { | ||
@@ -510,3 +513,3 @@ case 'granted': | ||
.getRegistration() | ||
.then(function (serviceWorkerRegistration) { | ||
.then((serviceWorkerRegistration) => { | ||
serviceWorkerRegistration.pushManager.subscribe(); | ||
@@ -535,4 +538,3 @@ }); | ||
hasPermission('microphone'), | ||
hasPermission('notifications'), | ||
hasPermission('push'), | ||
hasPermission('notifications', { userVisible: true }), | ||
]); | ||
@@ -547,3 +549,3 @@ return { | ||
nfc: false, | ||
notifications: results[4] && results[5], | ||
notifications: results[4], | ||
}; | ||
@@ -557,3 +559,3 @@ }; | ||
permissions: { | ||
backgroundSync: permissionsState.backgroundSync === 'granted', | ||
backgroundSync: permissionsState['background-sync'] === 'granted', | ||
bluetooth: permissionsState.bluetooth === 'granted', | ||
@@ -560,0 +562,0 @@ camera: permissionsState.camera === 'granted', |
import Browser from 'bowser'; | ||
const permissionsState = { | ||
backgroundSync: 'prompt', | ||
'background-sync': 'prompt', | ||
bluetooth: 'prompt', | ||
@@ -17,5 +17,8 @@ camera: 'prompt', | ||
navigator.permissions | ||
.query(Object.assign({ name: permissionName }, descriptor)) | ||
.then(function (permission) { | ||
.query({ name: permissionName, ...descriptor }) | ||
.then((permission) => { | ||
// console.log(`${permissionName}: ${permission.state}`) | ||
// update the global obj when it's checked | ||
if (permissionsState[permissionName]) | ||
permissionsState[permissionName] = permission.state; | ||
switch (permission.state) { | ||
@@ -52,3 +55,3 @@ case 'granted': | ||
.getRegistration() | ||
.then(function (serviceWorkerRegistration) { | ||
.then((serviceWorkerRegistration) => { | ||
serviceWorkerRegistration.pushManager.subscribe(); | ||
@@ -77,4 +80,3 @@ }); | ||
hasPermission('microphone'), | ||
hasPermission('notifications'), | ||
hasPermission('push'), | ||
hasPermission('notifications', { userVisible: true }), | ||
]); | ||
@@ -89,3 +91,3 @@ return { | ||
nfc: false, | ||
notifications: results[4] && results[5], | ||
notifications: results[4], | ||
}; | ||
@@ -99,3 +101,3 @@ }; | ||
permissions: { | ||
backgroundSync: permissionsState.backgroundSync === 'granted', | ||
backgroundSync: permissionsState['background-sync'] === 'granted', | ||
bluetooth: permissionsState.bluetooth === 'granted', | ||
@@ -102,0 +104,0 @@ camera: permissionsState.camera === 'granted', |
{ | ||
"name": "@therms/web-js", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Common web/JS tools & utilities", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
109976
1639