Cool Tip Of The Day: JavaScript Scope through
"subscript loaders"
Anyone who does advanced JavaScript work is familiar with the
concept of scope. It causes interesting problems, particularly if
you want your script to work with someone else's. (Function names
may be same, generating a strict warning... or variable names may
be the same, resulting in complete
silence...) This becomes especially annoying when you design
your application to accept overlays from others...
Enter a little-known component called the JavaScript subscript
loader. (I don't know the official name for it.) Many thanks to
timeless for suggesting this component.
The beauty of this component isn't that it can load scripts for
you... it's that you can give it a "scope" to play with. That scope
can be a simple JavaScript object. (Omitting the second argument
means it will use whatever scope it's being loaded from.)