Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19305] Alloy.Globals not accessible from a commonjs module

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-08-14T18:25:48.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.0.0
ComponentsWindows
LabelsAlloy, Windows
ReporterJörgen Buder
AssigneeKota Iguchi
Created2015-07-31T20:09:32.000+0000
Updated2015-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...

Comments

  1. Jörgen Buder 2015-08-14

    Hi Just tested the latest build of Ti SDK still not works.. 4.2.0.v20150813145415 Just FYI Thanks /Jörgen
  2. Kota Iguchi 2015-08-14

    https://github.com/appcelerator/titanium_mobile_windows/pull/402
  3. Ewan Harris 2015-09-03

    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

JSON Source