Created
April 10, 2012 23:29
-
-
Save egomez99/2355589 to your computer and use it in GitHub Desktop.
Unable to access global variable in commonjs Module in Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var globalClass = { | |
'testFunction1' : function() { | |
Titanium.API.debug("testFunction1 Called"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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