W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: [XHR2] Blobs, names and FormData

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 24 Aug 2011 23:36:13 -0700
Message-ID: <CA+c2ei8y2c758CZvLwF5=JH8Vz7Qj+kyt47LWm23Sigez1uLyA@mail.gmail.com>
To: Charles Pritchard <chuck@jumis.com>
Cc: Anne van Kesteren <annevk@opera.com>, WebApps WG <public-webapps@w3.org>
On Wed, Aug 24, 2011 at 12:57 PM, Charles Pritchard <chuck@jumis.com> wrote:
>>> Prpoposed:
>>> FormData output with the x-www-form-urlencoded mime type:
>>> formData.toUrlEncodedBlob(xhr.send)
>>> If going down the blob path, these two would have the same end-result:
>>> formData.toMultipartBlob(xhr.send)
>>> xhr.send(formData);
>> What kind of API-style is this?
> [Supplemental] FormData
> void toMultipartBlob(in callback)
> void toUrlEncodedBlob(in callback)
> The first would create a multipart mime message, in a blob, and run the
> callback with the blob as the first argument,
> the second would create a urlencoded message, in a blob, and also run the
> callback.
> They'd set the appropriate content type on generated blob.

The syntax you've written above wouldn't work in JS. You're only
passing in a reference to the send function, not a reference to the
XHR object on which to call .send on. So


is equivalent to


So in this case you'd have to pass in two argument, the function and
the 'this' object. Or require people to use .bind.

In general I'm not a fan of this syntax.

/ Jonas
Received on Thursday, 25 August 2011 06:37:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:23 UTC