[AC-5083] Liveview: Alloy.Globals undefined in 2nd run
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2017-08-08T19:53:55.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | liveview |
Reporter | Michael Gangolf |
Assignee | Shak Hossain |
Created | 2017-07-14T06:19:36.000+0000 |
Updated | 2017-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
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.
I got the expected output.