Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5083] Liveview: Alloy.Globals undefined in 2nd run

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2017-08-08T19:53:55.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsliveview
ReporterMichael Gangolf
AssigneeShak Hossain
Created2017-07-14T06:19:36.000+0000
Updated2017-08-08T19:53:55.000+0000

Description

When I run an app with Alloy.Globals defined in alloy.js I get an undefined is not an object error when the liveview updates for the first time. The first compile run is working fine. index.js
console.log(Alloy.Globals.device.height + " - " + Alloy.Globals.device.width);
$.index.open();
*index.xml*
<Alloy>
	<Window class="container">
	</Window>
</Alloy>
*alloy.js*
Alloy.Globals.device = {
	height: 100,
	width: 100
}
*Output*
 [INFO]  test_liveview/1.0 (6.1.1.c28220a)
 [LiveView]  Client connected
 [INFO]  100 100
 [LiveView]  Alloy recompile initiated for ios
 [LiveView]  Reload Triggered
   REASON:  File Changed
   FILE:  /Users/Development/test_liveview/app/controllers/index.js
 [LiveView]  Reload Triggered
   REASON:  File Changed
   FILE:  /Users/Development/test_liveview/Resources/iphone/alloy/sync/sql.js
[INFO]  [LiveView] Reloading App
[INFO]  UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO]  test_liveview/1.0 (6.1.1.c28220a)
 [LiveView]  Client connected
 [LiveView]  Client disconnected
 [INFO]  [LiveView] Error Evaluating app.js @ Line: 28
 [ERROR] TypeError: undefined is not an object (evaluating 'Alloy.Globals.device.height')
 [ERROR] File: app.js
 [ERROR] Line: 28
 [ERROR] SourceId: <null>
 [ERROR] Backtrace:
 [ERROR]  undefined
Ti SDK 6.1.1.GA Liveview iOS Simulator

Comments

  1. Sharif AbuDarda 2017-08-02

    Hello, I can't reproduce the issue with SDK 6.1.1.GA. Here is my log. At first I run the app with liveview enabled and got [INFO] 100 --- 100 output. Next i add -- and save index.js file and got the [INFO] 100 ----- 100 output. Thanks.
       [INFO]  hella/1.0 (6.1.1.c28220a)
        [LiveView]  Client connected
       [INFO]  100 --- 100
        [LiveView]  Alloy recompile initiated for ios
        [LiveView]  Reload Triggered
          REASON:  File Changed
          FILE:  /Users/sharifabudarda/Documents/Appcelerator_Studio_Workspace/hella/ap
       p/controllers/index.js
       [INFO]  [LiveView] Reloading App
        [LiveView]  Client disconnected
       [INFO]  UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
       [INFO]  hella/1.0 (6.1.1.c28220a)
        [LiveView]  Client connected
       [INFO]  100 ----- 100
       
    I got the expected output.

JSON Source