Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15029] LiveView: Alloy.Globals not visible in modules when using LiveView

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2013-09-03T15:58:30.000+0000
Affected Version/sRelease 3.1.2
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterBetty Tran
AssigneeIngo Muschenetz
Created2013-09-03T14:40:03.000+0000
Updated2017-03-20T22:04:29.000+0000

Description

Problem description

When using LiveView, the global variable Alloy.Globals is not defined in modules. Disabling LiveView would not throw the error.

Code to reproduce

Create an Alloy app with this code: index.js
var win = Ti.UI.createWindow({
    backgroundColor:'#ffffff'
});

Ti.API.info(Alloy.Globals.test);

var Test = require('test');
new Test();

win.open();
lib/test.js
function Test() {
	Ti.API.info(Alloy.Globals.test);
};

module.exports = Test;
Add the global variable in alloy.js:
Alloy.Globals.test = "TEST";

Actual behavior

When running the app with LiveView on, the following error is thrown:
[INFO] :   [LiveView] Error Evaluating app.js @ Line: 2
[ERROR] :  TypeError: 'undefined' is not an object (evaluating 'Alloy.Globals')
[ERROR] :  File: app.js
[ERROR] :  Line: 2
[ERROR] :  SourceId: 323744256
[ERROR] :  Backtrace:
[ERROR] :   #0 Controller() at :21
[ERROR] :  #1 () at :214
[ERROR] :  #2 anonymous() at :15
[ERROR] :  #3 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:628
[ERROR] :  #4 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:493
[ERROR] :  #5 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:460
[ERROR] :  #6 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:392
[ERROR] :  #7 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:663
Without LiveView, the error is not shown. Note that in index.js the error is not thrown.

Comments

  1. Ingo Muschenetz 2013-09-03

    Not positive why this was re-filed, but resolving as a duplicate.

JSON Source