3 ms·
At Mozilla, we were losing a few add-on download clicks because of the lag from putting the JavaScript at the bottom. So, we created a tiny bit of JS that recor
by gkoberger 14y ago
At Mozilla, we were losing a few add-on download clicks because of the lag from putting the JavaScript at the bottom. So, we created a tiny bit of JS that recorded important events, which we loaded in the <head>. The queue re-fired off the events once the JavaScript loaded.
https://github.com/mozilla/zamboni/blob/master/media/js/impala/preloaded.js https://github.com/mozilla/zamboni/blob/master/media/js/impa...
- deleted 14y ago[deleted]
- voidfiles 14y agoSo, the code you post requires jQuery, I am assuming, because you don't say. Which means you would need to also include jQuery in the header. Doesn't that seem like a waste? Also if you had jQuery already you could probably writing a queuing system for almost all actions, and not just "important" ones. You should take a queue from Flickr. I took a look at how they handled this, and I think it's one the best I have seen so far. http://dailyjs.com/2011/11/28/flickr-async/ http://dailyjs.com/2011/11/28/flickr-async/ The method there could actually be a small amount of code, and wouldn't require that you load jQuery before queuing events.
- cheatercheater 14y ago> because you don't say Use the source, Luke!