{ "id": "176169", "key": "AC-6697", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2021-06-03T10:40:45.000+0000", "created": "2021-04-27T06:24:23.000+0000", "labels": [], "versions": [ { "id": "17032", "name": "Appcelerator Studio 4.3.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-06-03T10:40:45.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": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Hi Team, \r\n\r\nWe have a classic app maintained for the long time. After upgrade from 8.2.1.GA to 9.3.2.GA, getting reference error while executing our app. \r\n\r\nSo we have global methods in *app.js* and we are accessing from other pages without including \"app. j's\". But after upgrading its throws exception while app executing. \r\n\r\nBelow sample code for app.js method:\r\n\r\nvar sampleMethod= function(){} \r\n\r\nSame sampleMthod we are accessing in other page without including the app.js. It works well in 8.2.1.GA\r\n\r\nI have fixed the issue just including \"app.js\" in page.\r\n \r\nSo is there any settings are available to enable the global methods. Instead of changing everyplace.\r\n\r\nPlease suggest.", "attachment": [], "flagged": false, "summary": "Method not defined reference error in Android Classic app using 9.3.2.GA ", "creator": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titianium SDK 9.3.2.GA\r\nAndroid Target SDK 29", "comment": { "comments": [ { "id": "458625", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~shishir.roy], this is part of the documented removal of the global scope for variables/functions declared in the app.js file. Please see this blogpost for recommendations https://devblog.axway.com/mobile-apps/how-to-globally-access-variables-and-functions-in-titanium/\r\n\r\nAlso, this type of question is not really the intention of this issue tracker, I would recommend making use of [ti-slack|https://tislack.org/] in future", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2021-04-27T09:18:42.000+0000", "updated": "2021-04-27T09:18:42.000+0000" }, { "id": "458629", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Right, like [~eharris] said, this was an intentional breaking-change made in Titanium 9.0.0. All functions and {{var}} declared variables in the \"app.js\" (or \"alloy.js\") are no longer global. If you want them to be global, then you need to do so explicitly.\r\n\r\nFor example, if you want to make the below variable and function global.\r\n{code:javascript}\r\n// app.js\r\nvar myGlobalString = \"Hello World\";\r\nfunction myGlobalMethod() {\r\n\treturn console.log(\"Global method called.\");\r\n}\r\n{code}\r\n\r\n...then change the above to the below. (Note the usage of the \"global\" object.)\r\n{code:javascript}\r\n// app.js\r\nglobal.myGlobalString = \"Hello World\";\r\nglobal.myGlobalMethod = function() {\r\n\treturn console.log(\"Global method called.\");\r\n};\r\n{code}\r\n\r\nYou can then access the above variables globally with the \"global.\" prefix in the rest of your code.\r\n{code:javascript}\r\n// foo.js\r\nconsole.log(myGlobalString);\r\nmyGlobalMethod();\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-04-27T22:26:53.000+0000", "updated": "2021-04-27T22:28:18.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }