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

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

From: Dan Beam <dbeam@chromium.org>
Date: Mon, 14 Apr 2014 21:41:51 -0700
Message-ID: <CANpe7K3r4qP2_jrOWJATFW=Cyi3E2n4Y5CwH-HAZwZC6pWnCvg@mail.gmail.com>
To: WHATWG <whatwg@whatwg.org>
Cc: bnicholson@mozilla.com, Evan Stade <estade@chromium.org>
Hey whatwg@,

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:

  form.requestAutocomplete().then(function() {
    // form.submit() or some other success action
  }, function(errorDetails) {
    // handle error based on errorDetails.reason (e.g. "cancel")

The returned promise would be resolved after the corresponding
"autocomplete" or "autocompleteerror" event is dispatched on the form.

Null would be passed on fulfillment* and

  {"reason": <matching AutocompleteErrorEvent#reason>}

would be passed on rejection.

There should be little compatibility risk as requestAutocomplete()
currently returns undefined.

Thoughts?  Concerns?  Questions?

Dan Beam

* until I think of something useful for the success case...

Received on Tuesday, 15 April 2014 04:42:38 UTC

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