Skip to content

Instantly share code, notes, and snippets.

@egomez99
Created April 10, 2012 23:29
Show Gist options
  • Save egomez99/2355589 to your computer and use it in GitHub Desktop.
Save egomez99/2355589 to your computer and use it in GitHub Desktop.
Unable to access global variable in commonjs Module in Android
Ti.include('/testLibrary.js');
var module = require('/testModule').call();
/**
* The output of above call is globalClass undefines in android. But in iOS this works fine
*/
var globalClass = {
'testFunction1' : function() {
Titanium.API.debug("testFunction1 Called");
}
}
function testModule() {
Titanium.API.debug("Test Module Called");
globalClass.testFunction1();
}
module.exports.call = function(){
return testModule();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment