- From: Marcos Cáceres <notifications@github.com>
- Date: Thu, 18 Nov 2021 15:45:56 -0800
- To: whatwg/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 18 November 2021 23:46:08 UTC
Not sure if this will work, but thought I'd pitch it...
Methods defined by various specs will check in a method call is "allowed to use" a particular permission. What might be nice is to have IDL level support for this. I was thinking something like an extended attribute, like:
```WebIDL
partial interface Navigator {
[Permission="webshare"] Promise<undefined> share(optional ShareData data = {});
[Permission="webshare"] boolean canShare(optional ShareData data = {});
};
```
In cases where the return type is a boolean, it would return `false` if not allowed - otherwise, do whatever the steps of the method require.
In other cases, it would throw or reject with a "NotAllowedError" DOMException.
cc @dontcallmedom @tidoust
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1066
Received on Thursday, 18 November 2021 23:46:08 UTC