Titanium JIRA Archive
Appcelerator Community (AC)

[AC-354] Windows 'app.js' is not part of the global scope

GitHub Issuen/a
ResolutionCannot Reproduce
Resolution Date2015-11-23T06:12:08.000+0000
Affected Version/sn/a
Fix Version/sn/a
ReporterAntje Schattat
AssigneeSharif AbuDarda


It looks like for Windows app.js is not part of the global scope, while indeed I know this is true for iOS and Android. In app.js the global variables 'isAndroid', 'isWindows' are defined. In the next CommonJS module Windows Phone does't know these global variables. I tested it with other global variables. These are also not found. Android und iOS know these. I will try my iOS/Android project to get ready for Windows Phone. I use CommonJS modules and the require () method, instead of Ti.include(). Well, it would be great if it works consistently. From my perspective, like as with iOS / Android, then I would not need so much change to the code.


  1. Sharif AbuDarda 2015-11-17

    Hello [~aschattat], From your description it's not clear what you are trying to do. Please provide a sample test case for windows platform to regenerate the issue. Thanks.
  2. Antje Schattat 2015-11-17

    I have in the file app.js a lot of variables, which are globally available in the app (iOS and Android). On Windows Phone the global variables are not available for other JS files. I have changed the normal variables in Ti.App variables for testing. Windows Phone Example: var DISPLAY_WIDTH = 320; (old => available only in app.js) Ti.APP.DISPLAY_WIDTH = 320; (new => available throughout the app) Since Appcelerator not yet 100% can provide an existing app for Windows Phone, I have canceled the test provisionally. There are too many (large and small) issues that do not justify the current effort. The test project was already an older development. A Classic app instead Alloy.
  3. Motiur Rahman 2015-11-23

    Hi [~aschattat], I have tested this issue you reported and didn't reproduce it with the latest Ti SDK. When we declare any variable to the app.js file and call it to the other commonJS module file, get that variable successfully. *Testing Environment:* Operating System Name = Microsoft Windows 8.1 Enterprise Version = 6.3.9600 Architecture = 32bit # CPUs = 4 Memory = 4198961152 Node.js Node.js Version = 0.12.7 npm Version = 2.11.3 Titanium CLI CLI Version = 5.0.5 Titanium SDK SDK Version = 5.1.0.GA, 5.0.2 SDK Path = C:\ProgramData\Titanium\mobilesdk\mobilesdk\win32\5.1.0.GA Target Platform = windows *Test Code:*
       var data = "this is global";
       var Window = require('ui/common/FirstView');
       var win = new Window();
       //FirstView Component Constructor
       function FirstView() {
       	//create object instance, a parasitic subclass of Observable
       	var self = Ti.UI.createWindow({
       		backgroundColor : '#ffffff'
       	//label using localization-ready strings from <app dir>/i18n/en/strings.xml
       	var label = Ti.UI.createLabel({
       		color : '#000000',
       		text : String.format(L('welcome'), 'Titanium'),
       		height : 'auto',
       		width : 'auto'
       	//Add behavior for UI
       	label.addEventListener('click', function(e) {
       	return self;
       module.exports = FirstView;

JSON Source