[whatwg] API to delay the document load event
David Bruant
bruant.d at gmail.com
Sun Apr 28 11:00:12 PDT 2013
Le 28/04/2013 19:47, Glenn Maynard a écrit :
> On Sun, Apr 28, 2013 at 12:28 PM, David Bruant <bruant.d at gmail.com
> <mailto:bruant.d at gmail.com>> wrote:
>
> Also, I don't see how nested calls to delayLoadEvent help any of
> your 2 use cases.
>
>
> Because multiple pieces of code on the page may need to do this
> independently. For example, you may have widgets on the page that
> need to send a request to a server to figure out what to display. The
> approach I suggested handles this, and could easily fire an event on
> the document automatically.
Each widget needs some way to express that it's ready, but doesn't
necessarily need to express it to the document directly. A "widget
manager" can load the widgets, gather all widgets "ready" events and
trigger the UA "AppReady" event when the widgets are ready.
I don't think we should be promoted patterns where widget are fully
independent which is pretty much the equivalent of a script injection
(where anything can happen, like one forgetting to call its
delay.finished()).
I believe one event to trigger will be hard enough in complex
applications, let's not allow more opportunities to mess it up by
distributing to independent actors the authority to trigger one event to
the UA.
David
More information about the whatwg
mailing list