Closure equivalent to Ext.onReady or dojo.addOnLoad

52 views
Skip to first unread message

chemhack

unread,
Apr 12, 2010, 4:50:47 PM4/12/10
to Closure Library Discuss
Hi,

I want some code executed after DOM is loaded just like Ext.onReady
and dojo.addOnLoad. Is there any built-in function to do this? I
didn't find anything in goog.events and goog.dom.

Cheers,

chemhack

Devraj Mukherjee

unread,
Apr 13, 2010, 12:41:57 AM4/13/10
to closure-lib...@googlegroups.com
We've been using

goog.events.listen(window, goog.events.EventType.LOAD, function(){
// app starts here
});

> --
> To unsubscribe, reply using "remove me" as the subject.
>

--
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)

Erik Arvidsson

unread,
Apr 13, 2010, 12:21:04 PM4/13/10
to closure-lib...@googlegroups.com
We've had this question before and I promised I would write a wiki about it. I will...

To sum it up it is better to add a script tag to the document after you know that your elements are available. This leads to less delays and less flickering.
--
erik
Reply all
Reply to author
Forward
0 new messages