Forums > Javascript

how to tell if a global is allready defined

February 8, 2006 | 3:05 am

if i have a js file which creates a global and some global js variables, how can i prevent another instance of that js overwriting/interfering with that global. Is there an "isdefined()" or similar method.

thanks,

oli

http://www.oli.adbe.org


February 8, 2006 | 10:28 am

Oliver, heres a little fragment. I had a hard time dealing with
this issue. and I’m still not quite sure what works and what
doesn’t. it’s an anomaly just seems to obvious to me. I mean who
want to define a global that you cant read elsewhere…. anyway this
seems to do the trick. its from my solomute.js

var gtabs = new Global("sologlobal");
if(gtabs[mygroup]==undefined)
{gtabs[mygroup]=new Object();}

someone more knowledgeable will probably say something more interesting

I’m about to pass out on benidryl. feh
plop
-matt

. . . . . . . . . . . .
http://www.EstateSound.com
http://ideasforstuff.blogspot.com
. . . . . . . . . . . .


February 9, 2006 | 11:09 am

hi matthew,

this method seems to be working. thanks very much,

oli

http://www.oli.adbe.org


Viewing 3 posts - 1 through 3 (of 3 total)