I'm misunderstanding something about global scope in javascript, and node.js
in particular.

I have a global data structure which drives my entire (small) node.js app.
For debugging, I wanted to be able to send a message to the app that
triggers dumping this struct to the console.

code is like:

var gRT = {};

... do things that fill this structure

I'm using a library defining a specialized UDP server, that accepts adding
message handling callbacks, and I add one like:

OSCserver.addMsgHandler(/\/rt$/, function (decoded) {
    console.log("gRT = " + gRT.inspect);
    return true;
});

after the callback is invoked (manually, well after initialization code is
finished running)  the console reads:
gRT = undefined

In node there is no 'window' object that is the owner of my global, as I
understand, so, as expected window.gRT.inspect doesn't work; neither does
GLOBAL.gRT.inspect.

Is there something I'm not understanding about global scope?

-- 
_________________________________________________________________
 tim perkis      1050 santa fe ave       albany ca 94706 usa
+01.510.717.3450

So convenient a thing it is to be a reasonable creature, since it enables
one to find or make a reason for everything one has a mind to do.  --
Benjamin Franklin

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to