{ "id": "104650", "key": "ALOY-370", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "14633", "description": "Alloy 0.3.3", "name": "Alloy 0.3.3", "archived": false, "released": true, "releaseDate": "2012-11-30" }, { "id": "14772", "description": "2012 Sprint 24", "name": "2012 Sprint 24", "archived": true, "released": true, "releaseDate": "2012-12-03" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-11-26T17:47:22.000+0000", "created": "2012-11-07T18:53:51.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "14631", "description": "Alloy 0.3.1", "name": "Alloy 0.3.1", "archived": false, "released": true, "releaseDate": "2012-11-02" } ], "issuelinks": [], "assignee": null, "updated": "2018-03-07T22:26:08.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "The below does not work:\r\n\r\nvar myFunc = function(){alert(\"hi there\")};\r\nexports.myFunc = myFunc;\r\n\r\nThe below works:\r\n\r\nfunction myFunc2(){ alert(\"Hello Again\")};\r\nexports.myFunc2 = myFunc2;\r\n\r\n\r\nThe issues is during the code generation, Alloy doesn't recognized variable assigned functions the same way it recognizes local functions. The result is that the generated code to assign the exports object is actually placed before the variable assigned function statement, leading to an undefined exports property.", "attachment": [], "flagged": false, "summary": "In order to assign functions to exports object in controller - you must declare a local function vs a variable assigned function", "creator": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "environment": null, "comment": { "comments": [ { "id": "228438", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Required change in runtime controller composition. Test case works now, as do the alloy test apps that rely on this behavior.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-11-26T17:47:22.000+0000", "updated": "2012-11-26T17:47:22.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }