Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Anne van Kesteren
On Fri, Aug 23, 2013 at 6:41 PM, Boris Zbarsky wrote: > Given the last definition of then() I saw, this has a bit of a gotcha. First we need to decide whether we care about making this promise-based. If we do, and we decide we care about compatibility for this edge-case, we can solve this using a

Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Tab Atkins Jr.
On Fri, Aug 23, 2013 at 10:41 AM, Boris Zbarsky wrote: > Given the last definition of then() I saw, this has a bit of a gotcha. > Consider this code: > > function callback() { > throw "Hey" > } > someAPI(callback); > > now in today's world, when some API calls back into callback an excep

Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Boris Zbarsky
On 8/23/13 1:23 PM, Tab Atkins Jr. wrote: On Fri, Aug 23, 2013 at 10:22 AM, Anne van Kesteren wrote: On Fri, Aug 23, 2013 at 6:09 PM, Boris Zbarsky wrote: If we want to continue returning void when a callback is passed, we need to add some webidl magic for that... My idea was to always retu

Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Tab Atkins Jr.
On Fri, Aug 23, 2013 at 10:22 AM, Anne van Kesteren wrote: > On Fri, Aug 23, 2013 at 6:09 PM, Boris Zbarsky wrote: >> If we want to continue returning void when a callback is passed, we need to >> add some webidl magic for that... > > My idea was to always return a promise. And if a callback is p

Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Anne van Kesteren
On Fri, Aug 23, 2013 at 6:09 PM, Boris Zbarsky wrote: > If we want to continue returning void when a callback is passed, we need to > add some webidl magic for that... My idea was to always return a promise. And if a callback is passed you just pass that to the promise "as listener". -- http:/

Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Boris Zbarsky
On 8/23/13 12:33 PM, Tab Atkins Jr. wrote: If a function currently takes a callback argument and returns void, it's trivial to upgrade it to instead make the callback optional and return a promise when it's not passed. And null if a callback is passed? If we want to continue returning void whe

Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Tab Atkins Jr.
On Fri, Aug 23, 2013 at 6:16 AM, Anne van Kesteren wrote: > On Fri, Aug 23, 2013 at 1:16 PM, Jeremie Patonnier > wrote: >> The spec define two static methods: `requestPermission` and `get` >> I'm a bit puzzled because `requestPermission` expect a callback function >> where `get` return a `Promise

Re: [whatwg] Web Notification: API inconsistency

2013-08-23 Thread Anne van Kesteren
On Fri, Aug 23, 2013 at 1:16 PM, Jeremie Patonnier wrote: > The spec define two static methods: `requestPermission` and `get` > I'm a bit puzzled because `requestPermission` expect a callback function > where `get` return a `Promise`. It's not clear to me we can change the design of requestPermis

[whatwg] Web Notification: API inconsistency

2013-08-23 Thread Jeremie Patonnier
Hi! I recently noticed the web notification spec [1] introduce an API inconsistency. The spec define two static methods: `requestPermission` and `get` I'm a bit puzzled because `requestPermission` expect a callback function where `get` return a `Promise`. As it seams obvious that both method are