{ "id": "120851", "key": "ALOY-841", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2014-01-20T22:07:04.000+0000", "created": "2013-10-07T08:28:38.000+0000", "priority": null, "labels": [ "alloy" ], "versions": [], "issuelinks": [], "assignee": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-02-28T23:57:15.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": "13610", "name": "Builtins", "description": "Builtin Javascript libraries" } ], "description": "I use this function to avoid global events not releasing local objects:\r\n\r\n{code}\r\nAlloy.Globals.once = function(event, cb) {\r\n var _cb = function() { \r\n cb.apply(this, arguments);\r\n // Clean up\r\n Ti.App.removeEventListener(event, _cb);\r\n };\r\n Ti.App.addEventListener(event, _cb);\r\n};\r\n{code}\r\n\r\nCome handy when there is UI/async call interaction allowing to preserve a workflow (instead of continuation callbacks).\r\n\r\nWould be meaningful to add to Alloy eg Alloy.once(\"an:app:event\", doOnceCb)?\r\n", "attachment": [], "flagged": false, "summary": "Add an `once` function for call-once global events", "creator": { "name": "lcapra", "key": "lcapra", "displayName": "luca capra", "active": true, "timeZone": "Europe/Rome" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": "Alloy 1.2\r\nSDK 3.1.3", "comment": { "comments": [ { "id": "288893", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{{Alloy.Globals}} is not meant to be an eventing interface, and I don't want to add code like this that will appear to make it so. This seems much better suited as an external library, or this simple implementation by the developer.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-20T22:07:04.000+0000", "updated": "2014-01-20T22:07:04.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }