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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 1 Oct 2014 09:14:40 -0400
Message-ID: <CAAWBYDAYWxpqacgj1s41nCUiXZoNeKtfqBCaKr8kZHwciLyVcQ@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: WHATWG <whatwg@whatwg.org>, Jake Archibald <jaffathecake@gmail.com>, Jonas Sicking <jonas@sicking.cc>, Andrew Wilson <atwilson@google.com>, Peter Beverloo <beverloo@google.com>
On Wed, Oct 1, 2014 at 9:06 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Wed, Oct 1, 2014 at 2:56 PM, Peter Beverloo <beverloo@google.com> wrote:
>> One argument I came across for overloading requestPermission is the
>> following:
>>     Promise.all([ Notification.requestPermission(),
>> swRegistration.push.requestPermission() ]).then(...);
>> Might be worth considering, it's relatively cheap to support and can be
>> implemented without breaking backwards compatibility.
> One minor risk with also returning a promise is that exceptions for
> incorrect invocation would no longer throw an exception, but instead
> reject the promise.
> Otherwise I would never expect this promise to be rejected as the user
> declining notifications is not exceptional.

Wait, what?  Anytime you request something, not getting it is
exceptional.  Not sure how you can make an argument otherwise.

Received on Wednesday, 1 October 2014 13:15:26 UTC

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