Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe add navigator.permissions.supports()? #136

Closed
marcoscaceres opened this issue Jan 27, 2017 · 1 comment
Closed

Maybe add navigator.permissions.supports()? #136

marcoscaceres opened this issue Jan 27, 2017 · 1 comment

Comments

@marcoscaceres
Copy link
Member

marcoscaceres commented Jan 27, 2017

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.

  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,

const permCheck = await navigator.permissions.query({ name: "whatever" });
permCheck.state === "unknown"; // or "not-supported"

or adds some kind of "navigator.permissions.supports()" method.

if (!navigator.permissions.supports("whatever")){
    return; // not supported, oh well.  
};
const  permCheck = await navigator.permissions.query({ name: "whatever" });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant