igrigorik / resource-hints

Moved to...
https://github.com/w3c/resource-hints
32 stars 7 forks source link

Provide an onload event #9

Closed bmaurer closed 10 years ago

bmaurer commented 10 years ago

It could be helpful for the preXX links to have an ondone event.

Concrete example of how this could be useful:

Imagine an application with an integrated chat application (eg, Facebook Messenger, Google Talk). The application does not want the (large) JS and CSS associated with the chat functionality to waste bandwidth while the site is just starting up. However, they would like to initiate the download of this JS and CSS as soon as they can.

They could rel=preload tags for the resources associated with this application. When those resources were loaded, they could use the ondone event to insert them into the DOM. In fact, maybe it would even make sense to provide an API for the user to do this explicitly (eg, you could have a makeIntoRealResource() api on the which would transform it into a real JS script or CSS stylesheet. This would be a synchronous api, equivalent to inserting an inline JS/CSS stylesheet)

igrigorik commented 10 years ago

Good feedback, thanks! I think we have a couple of threads that should cover these already:

Between those two, I think that'll cover it. Feel free to reopen.