Comment by wizzwizz4

Comment by wizzwizz4 a day ago

1 reply

It's not declaring a permission: it's instructing the browser to render a button. That's like saying <button onclick="Notification.requestPermission()">Notify me!</button> is declarative.

bastawhiz a day ago

It's declarative in that it's telling the browser to render a complete UI for showing and modifying the state of the permission. Just because there's also an imperative API that already exists doesn't mean it's not declarative. It's certainly not imperative, there's nothing imperative about it.

Moreover, it allows the user to show the browser controls for re-requesting the permission if it was previously denied, which isn't possible with the imperative API (because an imperative API can implicitly be abused).