W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: CfC: Proposal to add web packaging / asset compression

From: Charles Pritchard <chuck@jumis.com>
Date: Tue, 14 Feb 2012 05:14:31 -0800
Message-ID: <4F3A5E37.7020809@jumis.com>
To: Paul Bakaus <pbakaus@zynga.com>
CC: "public-webapps@w3.org" <public-webapps@w3.org>
On 2/14/2012 1:24 AM, Paul Bakaus wrote:
> window.loadPackage('package.webpf', function() {
>      var img = new Image();
>      img.src = "package.webpf/myImage.png";
> })
>
> Or alternatively, with a local storage system (I prefer option one):
>
> window.loadPackage('package.webpf', function(files) {
>      files[0].saveTo('myImage.png');
>      var img = new Image();
>      img.src = "local://<absolute path of url of site>/myImage.png";
> })


How about picking up FileSystem API semantics?

var img = new Image(); img.onload = myImageHandler;
var package = 'package.webpf';
var sprite = 'myImage.png';
window.requestFileSystem(package, 0, function(fs) {
     myPackagePolyfill(function(root) { img.src = 
root.getFile(sprite).toURL(); }, fs.root, package);
});

Packages would be calculated with the "temporary" file system quota.

I'm fine with it being a different method name, but re-using toURL makes 
a lot of sense.

I've heard more than once about how we shouldn't be requiring more 
formats. So I'd leave the mount format undefined, and just throw an 
error if it's not supported.
This still brings the package into the browser cache, it can be 
re-requested via XHR + ArrayBuffer (or blob), and manually parsed by JS 
polyfill.

 From a practical perspective:
Use uncompressed zip for packaging, it's trivial to support in JS these 
days.
Content is already compressed, typically, and deflate can be used in the 
request layer if the client-server relationship supports it.

Use the polyfill method to uncompress the files into the temporary file 
system if it's supported.
And if it's not supported, your polyfill can still use createObjectURL 
and file slice to handle business efficiently.

Just try to cleanup somewhere with a myPackagePolyfill.dispose(package);

-Charles
Received on Tuesday, 14 February 2012 13:14:56 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:50 GMT