Nicer code, Better compression, Ability to call nbl.l() multiple times#3
Nicer code, Better compression, Ability to call nbl.l() multiple times#3tahajahangir wants to merge 11 commits into
Conversation
|
Thanks for your contribution. Could you please give me some more background, as the diff just replaces all code wholesale? |
|
First of all, I decided to change the NBL a bit (as in third commit), but i found the code unreadable (it was like a minfied or obfuscated code). It appears you had used short varialbe and function names to reduce the code size, but it can achieved by using a good minifier (like google clousre compiler). At first commit, I only changed variable names (to meaningful ones) and also i converted object like structrue of NBL to function. So NBL is now a function with local variables rather than an object with multiple properties. At second commit, i changed the NBL to be jslint compliant. There are some small changes like converting "a && b()" to "if (a){ b();}". Note that google closure converted it back to "a && b()" at compile time ;) The third commit, is my goal to change NBL. The problem is that multiple calls to "nbl.l(['myscript.js'])" will add "myscript.js" to <head> multiple times. I used NBL at a situation like this: document.getElementById('showCalendar').onclick = function(){
// Try to load calendar scripts files
nbl.l([ ['calendar_script.js'], function() {
// script is loaded
showCalendar();
}]);
};I excpected that 'calendar_script.js' added to <head> once, but the new <script> is added with every call to nbl.l |
No description provided.