cjavapro
unread,Feb 7, 2011, 6:19:02 PM2/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Closure Compiler Discuss
If I am in the wrong place for a feature suggestion then please let me
know.
If your compiler creates the lines
var googleRandomSuff_setTimeout = setTimeout
var googleRandomSuff_clearTimeout = clearTimeout
at the beginning of a advanced compilable file and then renames
references of setTimeout to googleRandomSuff_setTimeout and
clearTimeout to googleRandomSuff_clearTimeout .
Then your existing functionality takes over and renames them to short
names. In the event that neither of those are used, your compiler will
remove them with its existing features. In the event it is used once,
your compiler will undo what I mentioned above using nothing but its
already existing features.
Then for every additional call to either of those, you will save an
average of 9 bytes.
That may not seem so cool, but you can do this for window, Date,
parseInt, parseFloat and many others.
In fact, even the scope problems that might have been created would be
eliminated by automatic features as this
setTimeout(...)
var setTimeout = function(){...}
setTimeout(...)
would change to this
var googleRandomSuff_setTimeout = setTimeout
googleRandomSuff_setTimeout(...)
var googleRandomSuff_setTimeout = function(){...}
googleRandomSuff_setTimeout (...)
which does the exact same thing.