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

Domenic Denicola domenic at domenicdenicola.com
Mon Apr 14 21:44:59 PDT 2014


From: whatwg-bounces at lists.whatwg.org [mailto:whatwg-bounces at 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.

>  {"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



More information about the whatwg mailing list