W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2014

Re: [whatwg] Notifications: making requestPermission() return a promise

From: Tobie Langel <tobie.langel@gmail.com>
Date: Wed, 8 Oct 2014 10:31:12 +0200
Message-ID: <CAMK=o4dCZXYmv2W+sVcLPKvcn2mmQ0fuFNzCtSAs_G52mv9s0A@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Andrew Wilson <atwilson@google.com>, WHATWG List <whatwg@whatwg.org>, Jake Archibald <jaffathecake@gmail.com>, Peter Beverloo <beverloo@google.com>, Jonas Sicking <jonas@sicking.cc>
On Wed, Oct 8, 2014 at 9:51 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> The question is whether it's not natural to assume that *if the promise
> fulfills*, that means they got permission. This allows them to do things
> like using Promise.all() to join multiple permission requests together and
> get a nice combined promise that fulfills when everything succeeds,

This is as simple as:

Promise.all(permissionRequests).then(function(results) {
    if (results.every(x => x === "granted")) // …

But I don't think it's the right approach to handling permissions in
general. Developers should handle granted permissions as progressive
enhancements, not balk when they don't get all the permissions they
required. Using exceptions for denied permissions sends a completely wrong
message imho, especially when it's combined with Promise.all.

Received on Wednesday, 8 October 2014 08:31:37 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:24 UTC