Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1633] Alloy should assign globals directly rather than using the implicit global scope of app.js

GitHub Issuen/a
Resolution Date2019-11-21T14:01:03.000+0000
Affected Version/sAlloy 1.13.1, Alloy 1.13.2
Fix Version/sCLI Release 7.1.2
ReporterEwan Harris
AssigneeEwan Harris



Alloy currently makes use of the implicit global scope of the app.js file to make the Alloy, _, and Backbone variables globals. Alloy should assign these to the global scope directly. When doing this we should be sure to replicate the exact behaviour of the existing code, so make sure that they stay overwritable etc.


  1. Ewan Harris 2018-09-27

    PR: https://github.com/appcelerator/alloy/pull/911
  2. Samir Mohammed 2019-11-19

    When disabling the global-scope plugin KS-v2 errors on start up due to the following error (global-scope plugin is due for removal in SDK 9):
       [ERROR]  Script Error {
       [ERROR]   column = 20;
       [ERROR]   line = 6;
       [ERROR]   message = "Can't find variable: _";
       [ERROR]   sourceURL = "file:///Users/Samir/Library/Developer/CoreSimulator/Devices/7A33F753-8B9A-4870-9FFD-E1711F060884/data/Containers/Bundle/Application/216ACE17-50FA-4BD4-8CEC-CB3E6C432565/KitchenSink.app/logger.js";
       [ERROR]   stack = " at Logger(/logger.js:6:20)\n at (/logger.js:37:24)\n at global code(/logger.js:40:70)\n at require@[native code]\n at (/alloy/controllers/index.js:5:22)\n at global code(/alloy/controllers/index.js:112:70)\n at require@[native code]\n at (/alloy.js:428:22)\n at (/app.js:34:23)\n at global code(/app.js:38:70)\n at require@[native code]\n at (/ti.main.js:17723:8)\n at loadAsync(/ti.main.js:17649:9)\n at global code(/ti.main.js:17720:10)";
       [ERROR]   toJSON = "<KrollCallback: 0x6000030550c0>";
       [ERROR]  }
  3. Ewan Harris 2019-11-20

    Fixed in https://github.com/appcelerator/alloy/commit/e638e557f87eab01bea8bd39c5afd64fcdcfb36c, new Alloy release going through Jenkins atm. Should be in a preprod CLI in ~1 hour
  4. Samir Mohammed 2019-11-21

    Closing ticket, fix verified in CLI version {"NPM":"4.2.15-1","CLI":"7.1.2-master.9"}. Tested using the KS-V2 app and disabling the global scope.

JSON Source