{ "id": "109458", "key": "TIMOB-12648", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": null, "resolutiondate": null, "created": "2013-02-08T21:38:21.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [], "issuelinks": [ { "id": "25650", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "104896", "key": "TIMOB-11752", "fields": { "summary": "Android: Globals not accessible in CommonJS modules", "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 } } } }, { "id": "30563", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "117836", "key": "TIMOB-14721", "fields": { "summary": "LiveView: App.js Lexical Scope local vars not globally available ", "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": "2018-02-28T20:04:27.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "Sharing variables between modules is complex. The proper way is to use an intermediary to pass the values back and forth, but this is a lot of effort for something simple. Some platforms simply reuse the same context for all modules (this is undocumented), but that is a bad idea for both performance reasons and because it increases the chance of nasty bugs.\r\n\r\nThe proper way is to have some variable in the \"module\" scope that allows access to the true global scope. There is plenty of precedence for this because browsers have the \"window\" object and node.js has the \"global\" object that references the \"true\" global scope.\r\n\r\nWe should do something similar and provide a \"global\" object.", "attachment": [], "flagged": false, "summary": "TiAPI: Create a \"global\" variable", "creator": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "238125", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "IMHO - sharing variables between CommonJS modules is ... not so hard. :)\r\n\r\n\r\nCommunity devs use \"global\" (so to say) module and require it where it is needed.\r\n\r\n\r\n{code}\r\n//globals.js\r\n\r\n//trivial implementation\r\nmodule.exports = {};\r\n\r\n\r\n//module1.js\r\nvar globals = require('globals');\r\n\r\nglobals[\"testVar\"] = \"Something\";\r\n\r\n\r\n//module2.js\r\nvar globals = require('globals');\r\n\r\n//somewhere\r\nTi.API.info(globals[\"testVar\"]);\r\n\r\n{code}", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-02-12T16:44:58.000+0000", "updated": "2013-02-12T16:44:58.000+0000" }, { "id": "295668", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Backlog? :(", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2014-03-04T23:08:13.000+0000", "updated": "2014-03-04T23:08:13.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }