- From: Marcos Cáceres <notifications@github.com>
- Date: Thu, 26 Jan 2017 23:06:01 -0800
- To: w3c/permissions <permissions@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 27 January 2017 07:06:59 UTC
Can't remember if this was raised previously, but was coding something up and found that I had to wrap the API in a try/catch a little bit annoying when a name of a permission might be potentially unknown.
```JS
let permCheck;
try {
permCheck = await navigator.permissions.query({ name: "whatever" });
} catch (err) {
return; // not supported
}
```
I wonder if we can either change the name in the dictionary to allow a DOMString,
```JS
const permCheck = await navigator.permissions.query({ name: "whatever" });
permCheck.state === "unknown"; // or "not-supported"
```
or adds some kind of "navigator.permissions.supports()" method.
```JS
if (navigator.permissions.supports("whatever")){
return; // not supported, oh well.
};
const permCheck = await navigator.permissions.query({ name: "whatever" });
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/permissions/issues/136
Received on Friday, 27 January 2017 07:06:59 UTC