Luckily, I moved all the javascript code out of my documents and into external js files years ago, so there is no having to go through lots of markup to deal with inline tags that are burried deep within. Most of the stuff shall convert nicely and now I never have to worry about namespace conflicts ever again and will never have to track down little code snippets.
Surebert is no longer surebert but the surebertCom library which has a communicate object to replace the old surebert 1.6.
None of this probably means anything to anyone, but I want to note this day for when I look back.
I will make the library publically available at some point in the near future.
The objects themselves can a sort of namespace. e.g.
myLib={
jump: function(){
alert('jump');
},
run: function(){
alert('run');
},
swim:function(){
alert('run');
}
}
now I can safely use even if I am using other javascripts that has a jump() function.
mylib.jump();
if you know you aren't going to have a conflict that you can use
jump = myLib.jump; to make a sort of global alias to the function
jump();
The nice thing is all these objects can interact and extend each other and javascript object literal notation is so easy to read and maintain.
I group all my objects in the surebertCom object and then it has further breakdowns into uses and types e.g. surebertCom.strings, subrertCom.sounds, etc
Refactoring is wonderfully cathartic, isn't it?
Total geekdom. I love it.
I updated my journal to explain more what I meant.
Javascript has namespaces?! Let's all hope that they're less awkward than XML namespaces.
- Z