Hi All,
Im currently working on ways of pacakaging javascript
functions/variables/objects in a similar way to the Java package
statement so that scripts can be interact with each other with the
minimum risk of clashing (due to function/variable name clashes). Do
any of you do this already and/or are there any techniques you've come
across?
Im aware that ECMAScript 2 has this facility and have seen several
scripts that use some thing like this:
var com = [];
com.test = [];
com.test.isVali d = function() {
....
}
com.test.isVali d();
so the only entry point to there scripts is through the com and test
objects but this is rather primative and can be easily accidentally
overwritten by other scripts. Anyone thought much about this?
Any feedback or opinions would be much appreciated...
Cheers,
Dan Webb
Im currently working on ways of pacakaging javascript
functions/variables/objects in a similar way to the Java package
statement so that scripts can be interact with each other with the
minimum risk of clashing (due to function/variable name clashes). Do
any of you do this already and/or are there any techniques you've come
across?
Im aware that ECMAScript 2 has this facility and have seen several
scripts that use some thing like this:
var com = [];
com.test = [];
com.test.isVali d = function() {
....
}
com.test.isVali d();
so the only entry point to there scripts is through the com and test
objects but this is rather primative and can be easily accidentally
overwritten by other scripts. Anyone thought much about this?
Any feedback or opinions would be much appreciated...
Cheers,
Dan Webb
Comment