Hi Robert,
Tried to comment on your blog without success...
You can shorten your code quite a bit:
Event.asap = function(callback) {
document.loaded ? callback() :
document.observe(''dom:loaded'',
callback);
};
Best,
Tobie
On Feb 22, 7:59 am, Robert Schmelzer
<rfschmel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> I created a small enhancement for the event object. I had the problem
> that I want to execute my code as soon as possible. So during page
> load at dom:loaded and in an AJAX call immidiatly. Therefore I created
> an Handler into Event: Event.asap(function handler):
>
> Object.extend(Event, {
> _isDomReady : false,
>
> asap: function(f) {
> this._isDomReady ?
> f() : document.observe(''dom:loaded'', f);
> }});
>
> document.observe(''dom:loaded'', function()
{Event._isDomReady > true;});
>
> More details
here:http://blog.schmelzer.cc/archives/19-Execute-Javascript-as-soon-as-po...
>
> Feedback is very welcome!
>
> Robert
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---