[ALOY-1015] LiveView: Ti.include statements not supported
GitHub Issue | n/a |
Type | Bug |
Priority | Low |
Status | Resolved |
Resolution | Won't Fix |
Resolution Date | 2014-06-23T18:53:03.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | supportTeam |
Reporter | Eduardo Gomez |
Assignee | Unknown |
Created | 2014-05-14T17:30:03.000+0000 |
Updated | 2018-03-07T22:26:00.000+0000 |
Description
Issue description
After enabling LiveView Ti.include statements are not loaded correctly.
Running app normally works fine. The app has the following similar structure:
alloy.js
Ti.include('testing.js');//File: "app/lib/testing.js"
setConfig("username", "appc_developer");
var name = getConfig("username", 0);
alert(name);
Console Output
[INFO] : Focusing the iOS Simulator
[LiveView] version 1.0.4
[LiveView] File Server Started on Port 8324
[LiveView] Alloy project monitor started
[LiveView] Event Server Started on Port 8323
[INFO] : Application started
[INFO] : TestLiveView/1.0 (3.2.3.GA.b958a70)
[LiveView] Client connected
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:638\n#1 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:502\n#2 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:469\n#3 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:403\n#4 () at file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js:676";
[ERROR] : line = 608;
[ERROR] : message = "'undefined' is not a function (evaluating '_src.replace(/\\/\\/(.*)$/gm, '')')";
[ERROR] : name = TypeError;
[ERROR] : sourceId = 300321376;
[ERROR] : sourceURL = "file:///Users/egomez/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/ADCAFC30-B60E-488C-A977-4E77631DE3CD/TestLiveView.app/app.js";
[ERROR] : }
Titanium Classic
LiveView is able to detect changes made by using a Titanium Classic app. To test it out just place "testing.js" into Resources folder and use the following code for replicate:
app.js
Ti.include('testing.js');
setConfig("username", "appc_developer_");
var name = getConfig("username", 0);
alert(name);
Console Output
[INFO] : Focusing the iOS Simulator
[LiveView] version 1.0.4
[LiveView] File Server Started on Port 8324
[LiveView] Event Server Started on Port 8323
[INFO] : Application started
[INFO] : TouchTestIDs/1.0 (3.2.3.GA.b958a70)
[LiveView] Client connected
[INFO] : [object ComAppceleratorApmModule] loaded
[INFO] : [object ComSoastaTouchtestModule] loaded
[LiveView] Reload Triggered
REASON: File Changed
FILE: /Users/egomez/Documents/Appcelerator_Studio_Workspace/TouchTestIDs/Resources/app.js
[LiveView] Client disconnected
[INFO] : [LiveView] Reloading App
[INFO] : UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO] : TouchTestIDs/1.0 (3.2.3.GA.b958a70)
[LiveView] Client connected
testing.js
function setConfig(name, value) {
Titanium.App.Properties.setString(name, value);
}
function getConfig(name, defaultvalue) {
return Titanium.App.Properties.getString(name, defaultvalue);
}
Comments
- Malcolm Hollingsworth 2014-05-14
Ti.include should be deprecated and removed as soon as possible. It was a solution to a problem that has long been solved.
If you are wanting to include large sections of code in-line then re-think and convert them to CommonJS. Problem solved and much better code in your app.
- Tim Poulsen 2014-05-19
Per TIMOB-16984, Ti.include is likely to be deprecated. Consider closing this ticket as a result.
- Eduardo Gomez 2014-05-19
Thanks [~skypanther],
Client ported everything to CommonJS already. Looking forward to see this in 3.3.0 (Ti.include removed) and official.
Close ticket as applicable.
- Tim Poulsen 2014-06-23
Because Ti.include() has been deprecated, I'm closing this as won't fix.
JSON Source