Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COfrom a page load perspective it definitely makes sense to take the hit of downloading all of the JS up front and cache client-side, so i think a merged file is fine. But if you are doing lots of stuff in the document ready handler, it doesn't make sense to have lots of code *execute* (downloading is a one-time hit, but executing needless code is incurring a cost for every page load). I am aware of multiple ready handlers, but i don't think it really solves the issue and may incur it's own performance problems (presumably firing many events is more costly than firing one larger event)
      singulars
    2. COYeah, I only suggest multiple ready handlers in the scenario of multiple JS files. That way the browser is still caching the various JS files but any given page only loads the ones it needs and only executes the code it needs. I'm assuming firing many events that do only what you need is better than firing one larger event that (according to your question) may be 90% irrelevant.
      singulars
    3. COyou make a valid point, but the main factor in page load is number of HTTP requests, and i wish to abide by this rule. I've started thinking of an approach where i can declaratively add classes to the body (server side). These would describe the type of page (to keep things semantic), using JS i could then look these up, and use them as keys to access specific pieces of functionality on some object. This extra logic and lookups will incur some cost, but should provide gains by focusing the amount of code executed per page. i'd need to benchmark. A rough prototype: http://jsfiddle.net/v5QZn/
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload