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

RE: Lazy Blob

From: Jungkee Song <jungkee.song@samsung.com>
Date: Thu, 02 Aug 2012 21:33:20 +0900
To: 'Glenn Maynard' <glenn@zewt.org>, 'WebApps WG' <public-webapps@w3.org>
Cc: 'Robin Berjon' <robin@berjon.com>
Message-id: <00a801cd70ab$005d1070$01173150$%song@samsung.com>
Hi Glenn and all,

> From: Glenn Maynard [mailto:glenn@zewt.org] 
> Sent: Thursday, August 02, 2012 12:45 AM
> To: Robin Berjon
> Cc: WebApps WG; Jungkee Song
> Subject: Re: Lazy Blob
>>  On Wed, Aug 1, 2012 at 9:59 AM, Robin Berjon <robin@berjon.com> wrote:
>>  var bb = new BlobBuilder()
>>,   blob = bb.getBlobFromURL("http://specifiction.com/kitten.png", "GET", { Authorization: "Basic DEADBEEF" });
>>  Everything is the same as the previous version but the method and some headers can be set by enumerating the Object. I *think* that those are all that would ever be needed.
> We already have an API to allow scripts to make network requests: XHR.  Please don't create a new API that will > end up duplicating all of that.  However this might be done, it should hang off of XHR.

* Let me use the word *Lazy* until we get a consensus upon the term.

As stated at the proposal, we came up with certain use cases in Web Intents postResult() callback. In this use case, there is no certain moment at which the client can explicitly trigger XHR request. Rather, it has to wait  huge Blobs of data (e.g., an array of Media objects in the Pick Media Intent [1]) on its intents callback.

Here is an example:

navigator.startActivity(intent, mediaOK, mediaFail);

function mediaOK (mediaObjectArray) {
    // iterate over the array of media objects to do something useful with them
    console.log(mediaObjectArray.length + "media objects") // In console, "> 250 media objects"
    for (var i = 0; i < mediaObjectArray.length; i++) {
        // read mediaObjectArray[i].content.blob triggers actual resource transfer

At the point the mediaOK() callback is called, 250 *Lazy* Blobs from an image gallery is ready.

var mediaObjectArray = [];
// e.g., the service builds *mediaObjectArray* containing hundreds of png files from an image gallery
{ // loop
    var bb = new BlobBuilder()
    ,   blob = bb.getBlobFromURL("http://specification.com/kitten00.png", "GET", { Authorization: "Basic DEADBEEF" });

    var content = {};
    content.blob = blob;

    mediaObject.content = content;


Personally, I prefer option B (used in this email) as it is fairly simple to developers while providing useful options.

[1] http://w3c-test.org/dap/gallery/


Jungkee Song
Samsung Electronics
Received on Thursday, 2 August 2012 12:35:12 UTC

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