{ "id": "172661", "key": "TIMOB-26593", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2019-07-12T17:21:30.000+0000", "created": "2018-11-22T14:54:24.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "issuelinks": [ { "id": "57039", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "inwardIssue": { "id": "172326", "key": "TIMOB-26403", "fields": { "summary": "kitchensink-v2 broken on latest SDK build on master ", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2019-07-12T17:21:30.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "Hello!\r\n*Steps to reproduce*: \r\napp.js\r\n{code}\r\nvar axwayExample = true; \r\nvar data = \"\"; // this works with 7.4.1GA\r\n// data = \"\"; // this works 7.5.0GA\r\n\r\nif (axwayExample) { \r\ndata = \"this is global data\"; \r\n\r\n} else { \r\ndata = \"this is login global data\";\r\n}\r\nvar platform = Ti.Platform.osname; \r\nvar Window = require('/FirstView');\r\nvar win = new Window();\r\nwin.open();\r\n{code}\r\nFirstView.ja\r\n{code}\r\nfunction FirstView() {\r\n\tvar self = Ti.UI.createWindow({\r\n\t\tbackgroundColor : '#ffffff'\r\n\t});\r\n \r\n\tvar label = Ti.UI.createLabel({\r\n\t\tcolor : '#000000',\r\n\t\ttext : 'Hello',\r\n\t\theight : 'auto',\r\n\t\twidth : 'auto'\r\n\t});\r\n\tself.add(label);\r\n \r\n\t//Add behavior for UI\r\n\tlabel.addEventListener('click', function(e) {\r\n\t\talert(data);\r\n\t});\r\n \r\n\treturn self;\r\n}\r\nmodule.exports = FirstView;\r\n\r\n{code}\r\n*Discription*:\r\nIn 7.4.1 and earlier, any variables defined with the var keyword in app.js were considered as \r\nglobal variables. But it's not working in 7.5.0.GA\r\nYou can see that to get global variables to work on 7.5.0, the data variable \r\nneeds to be defined without the var keyword. \r\n\r\nThe main difference in code is that I define the data variable, and set \r\nit to an empty string. Then with a if statement, I modify the data \r\nvariable, but it does not get passed to the alert function in 7.5.0GA \r\nunless I do the change as indicated.\r\n\r\nTest Environment:\r\n{code}\r\nOperating System\r\n Name = Microsoft Windows 10 Pro\r\n Version = 10.0.17134\r\n Architecture = 32bit\r\n # CPUs = 4\r\n Memory = 17091956736\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 7.5.0.GA\r\n{code}\r\nThanks ", "attachment": [], "flagged": false, "summary": "Problem with variable scope in SDK 7.5.0GA", "creator": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "subtasks": [], "reporter": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "environment": "Operating System\r\n Name = Microsoft Windows 10 Pro\r\n Version = 10.0.17134\r\n Architecture = 32bit\r\n # CPUs = 4\r\n Memory = 17091956736\r\nNode.js\r\n Node.js Version = 8.9.1\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 7.5.0.GA", "comment": { "comments": [ { "id": "443853", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~aislam] The behaviour they have mentioned is deprecated as of 7.5.0, see https://docs.appcelerator.com/platform/latest/#!/guide/Titanium_SDK_7.5.0_Functionality_Update.\r\n\r\nWe transform their code to try and fix the solution for them (for now), but evidently it isn't fully correct when the variable is also used in the {{app.js}} file. \r\n\r\nWe will fix that, but I would recommend them to update their code to directly assign to the global scope using {{global.data = \"\"; }}", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2018-11-22T16:36:31.000+0000", "updated": "2018-11-22T16:36:31.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }