1.71-proofing oxps
Posted: Sun Mar 30, 2008 3:00 pm
Thanks to new improved javascript methods & options, 1.71 should be much better for oxp writing purposes than ever before, but... there are quite a few bits and bobs that aren't the same between 1.70 and 1.71.
Bearing in mind that 1.71 is still very much a moving target, and what I'm about to say might be slightly irrelevant by the time 1.71 is released, I found a few general incompatibilites between 1.70 and 1.71 that are fairly easy to correct. Here are my initial findings, including code that will 'do the right thing' in both 1.70 & 1.71. Please take this advice with a pinch of salt!
Please avoid. While it should work without problems, at the moment the javascript object model in 1.71 adds extra elements at the end of arrays.
A safe alternative:
Writing to the log from your oxp can be a bit of a problem now, since in 1.71 you will get a lot of warnings in the log if you use older log commands to write to the log. Did I mention 'log'?
My solution?
then whenever I want to write to the log I use
I've just redone a few oxps that had problems with 1.71, and those two kept cropping up all the time
Hope this helps others not to make the same mistakes, etc...
Bearing in mind that 1.71 is still very much a moving target, and what I'm about to say might be slightly irrelevant by the time 1.71 is released, I found a few general incompatibilites between 1.70 and 1.71 that are fairly easy to correct. Here are my initial findings, including code that will 'do the right thing' in both 1.70 & 1.71. Please take this advice with a pinch of salt!
Code: Select all
for (let i in array){//whatever}
A safe alternative:
Code: Select all
for (let i=0;i<array.length;i++){//whatever}
Writing to the log from your oxp can be a bit of a problem now, since in 1.71 you will get a lot of warnings in the log if you use older log commands to write to the log. Did I mention 'log'?
My solution?
Code: Select all
this.Log=function(str){
if (typeof log != 'undefined') log("script."+this.name, str);
else LogWithClass("script."+this.name, str);
}
Code: Select all
this.Log('testing, testing..');
Hope this helps others not to make the same mistakes, etc...