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

Re: [whatwg] Proposal: HTMLFormElement#requestAutocomplete() should return a Promise

From: Dan Beam <dbeam@chromium.org>
Date: Tue, 15 Apr 2014 16:29:05 -0700
Message-ID: <CANpe7K25BCCFJuS89YQ9Od81ZhPDVdxUoyzP0uz=BTUpnzJqTw@mail.gmail.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
Cc: WHATWG <whatwg@whatwg.org>, "bnicholson@mozilla.com" <bnicholson@mozilla.com>, Evan Stade <estade@chromium.org>
On Mon, Apr 14, 2014 at 9:44 PM, Domenic Denicola <
domenic@domenicdenicola.com> wrote:
>
> From: whatwg-bounces@lists.whatwg.org [mailto:
whatwg-bounces@lists.whatwg.org] On Behalf Of Dan Beam
>
> > I propose requestAutocomplete()[1] should return a Promise.  This has
been requested since the creation of this API[2][3] and seems like a
natural fit.  Web authors can then call requestAutocomplete() like this:
>
> I strongly support this.
>
> > Null would be passed on fulfillment* and
>
> `undefined` would be better, as that is what normal JavaScript functions
return when they have nothing to return.

So just pass no argument at all (i.e. arguments.length == 0)?  I was under
the impression some type of value should always be returned (but I'm biased
by blink/v8's current implementation).

>
> >  {"reason": <matching AutocompleteErrorEvent#reason>} would be passed
on rejection.
>
> Rejection reasons should always be instanceof Error:
https://github.com/w3ctag/promises-guide#rejection-reasons-should-be-errors
>

Great, will figure out a way to subclass Error to provide some type of
"reason" property on the rejection argument.

--
Dan Beam
dbeam@chromium.org
Received on Tuesday, 15 April 2014 23:29:50 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:28 UTC