Lifecycle - booting up web apps

So, taking up Brian's proposal to solve immediate problems (and for us not to fly off the rails into [insert browser engine here]-dependency-land), I would like to propose addressing the following use case (I think Scott, cc'ed, raised this one a while ago on public-webapps and I've been discussing it a friend recently).  

 When one writes a native application, usually they are able to pass that application options through the the command line. For example:  

foo --help
foo --do this --with that --with this

This is naturally very useful for native applications that are CLI-based… but are also very useful for enabling/disabling things in graphical applications.  

In non-webby applications, the usual pattern to handle this is (e.g., in java):

public static void main(String[] args){
//process args  
}

On the Webs, the usual way of handling this is unload and DOMContentLoaded, I guess…. there is probably other ways (e.g., $(function(){…}) and setting some cookie/localStorage flag).  

Without getting into an interesting discussion about REST, and what it means for Installable Web Apps, the idea that an installed application is started in much the same way as any other native application.  

==Strawman==
What would be cool would be to have a lifecycle event fired at the widget with these options (calling it "boot", but it could be "options", "start", "main", whatever):

widget.addEventListener("boot", function(e){
var args = e.args; //String[] args :)  
 //process args
})  

if widget apps where native:  

./my.wgt -foo bar -x y -z

I guess for other systems that boot applications from a uri:

[uri]://aeb12cxv-adsf-vv/?foo=bar&x=y&z  

Not sure yet exactly when the event would be fired (before DOMContentLoaded? After?).  

Kind regards,
Marcos  

--  
Marcos Caceres
http://datadriven.com.au

Received on Monday, 5 September 2011 13:25:42 UTC