[whatwg] API to delay the document load event

Bjoern Hoehrmann derhoermi at gmx.net
Thu Apr 25 17:15:04 PDT 2013

* Glenn Maynard wrote:
>This seems a bit heavy-handed.  For these use cases, it doesn't seem like
>you need to delay the whole onload event, which would have tons of
>side-effects on the page.  You could just tell the browser that you're
>still doing things, without it having other script-visible effects.
>The particular API above makes it easy for calls to be mismatched in subtle
>ways, which would be hard to debug. I'd recommend doing this with an
>delay = document.delayCompletion();
>That way, you can simply call finished() anywhere your process can finish,
>without having to worry about calling it too many times.

This seems to be based on the assumption that all relevant code works on
the `delay` variable, without addressing the case of calling the method
`delayCompletion(...)` multiple times.

>Both of these APIs are effectively manual resource collection, though,
>which makes me nervous.  It's not something the platform is designed for
>(hence all the difficulty with blob URLs).  Something like
>document.delayUntil(indexedDbTransaction) would be nicer...

That also does address calling `delayUntil(...)` multiple times. And in
both cases, if multiple calls to either method have to be matched up,
you end up with the same problem that those multiple calls are hard to
match up. In the case of my IECapt and CutyCapt utilities, there is no
way to wait "a long time" to take a snapshot, so any such method would
time out, and quickly. Also note that this does not address the most
common cases, like isolated "widgets" that are transcluded, where even
the main code running on a page has trouble coordinating all the loads
of the resources it depends on. When is a Flash <object> ready to be
snapshotted, for instance?
Björn Höhrmann · mailto:bjoern at hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

More information about the whatwg mailing list