commonJS & Global Variable Arrays module

You must Login before you can answer or comment on any questions.

Don't know how i can save a array instead of variables in commonJS module as described here: commonJS & Global Variable

I tried the following code, but it doesn't work:

globals.js

exports.GV  =
{
    exorted_array:   []
};
 
exports.GVUpdate   = function(inValue, inName, arrNum)
{
    this.GV[inName[arrNum]]    =     inValue;
};
using from window code with the following commands:
VARS.GVUpdate(mylabel, 'exorted_array', c);
VARS.GV.articlecount[0].text = "..."
Please forgive my errors, but i'm just beginning with titanium. Thanks for any help!

1 Answer

Try this:

var foo = {};
 
foo.bar = function() { 
// your code here
}
 
module.exports = foo;

Your Answer

Think you can help? Login to answer this question!