This limitations urge programmers to find out not only how to optimise network transfer, but parsing process, as well. Even though today’s mobile phones’ CPUs are fairly strong (or at least seem to be), real speed of parsing and reindering of one page is not even comparable to the desktop colegues.
Google’s approach to lazy JS parsing
My approach to lazy JS parsing
One briliant feature of all today’s browsers is – cache. Yes, the cache of browser allows us to do things a way trickier (and our servers less loaded). And files once downloaded … yes, you guessed it: not downloaded the second time once requested twice.
I am not of the best JS programmers, but this is what I got so far:
Please, feel free to send PRs and comments, I would like to see the code being as much clear and usable, as possible.
For now, the code contains three methods.
parseLocal() is just small bonus to make Google’s solution available to the world.
There is no need to create new instance of the object as all methods are the static ones. So it is just an static object.
Code is fun, isn’t it?Google+