Welcome to ClipClip!
Already a Member? Sign In
 

Burning Chrome: Cool Tip Of The Day: JavaScript Scope through "subscript loaders"

source: http://weblogs.mozillazine.org/weirdal/archives/008101.html

clipped by chao May 28, 2006

firefox loader

use ajax in my web apps

  • 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.)

 

Comments

No comments yet

Please sign in to comment.