- From: Dan Beam <dbeam@chromium.org>
- Date: Mon, 14 Apr 2014 21:41:51 -0700
- 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
dbeam@chromium.org
* until I think of something useful for the success case...
[1]
http://www.whatwg.org/specs/web-apps/current-work/#dom-form-requestautocomplete
[2]
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/0TnqLOvC2ZY
[3]
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/aqKcZkCMsUI
Received on Tuesday, 15 April 2014 04:42:38 UTC