[TIMOB-19305] Alloy.Globals not accessible from a commonjs module
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-08-14T18:25:48.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.0.0 |
Components | Windows |
Labels | Alloy, Windows |
Reporter | Jörgen Buder |
Assignee | Kota Iguchi |
Created | 2015-07-31T20:09:32.000+0000 |
Updated | 2015-09-03T18:43:20.000+0000 |
Description
In iOS and Android I am able to access the Alloy.Globals without require in the Alloy module, but in Windows I have to require the module:
var Alloy = require('alloy');
Before I can use the Globals variables like custom ones defined in the alloy.js file.
As I said for iOS and Android this is not needed.
I am not sure which is wrong and right here, because in the Alloy.Controller documentation it states that to be able to reach Alloy.createController or the collections one needs to require first, but this is not true for iOS and Android, maybe this is by chance it works for iOS and Android? I do not know.
To reproduce:
Module: (in the /lib folder)
//var Alloy = require('alloy');
exports.test = function(){
Ti.API.info('Test Module');
Ti.API.info('Module Wintop ' + Alloy.Globals.winTop);
};
In alloy.js:
Alloy.Globals.winTop = 6;
Ti.API.info('Wintop ' + Alloy.Globals.winTop);
var t = require('testmod');
t.test();
Code will crash unless the require is included, but only for Windows...
Hi Just tested the latest build of Ti SDK still not works.. 4.2.0.v20150813145415 Just FYI Thanks /Jörgen
https://github.com/appcelerator/titanium_mobile_windows/pull/402
Verified using: Windows 8.1 Appc CLI Core: 5.0.0-33 Appc CLI NPM: 4.2.0-1 Titanium SDK: 5.0.0.v20150902095518 Nokia Lumia 930 8.1 Using the provided test case Alloy.Globals are now accessible from a commonjs module Closing ticket