{ "id": "174755", "key": "ALOY-1724", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2020-02-20T16:53:29.000+0000", "priority": null, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-03-02T15:25:24.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": [], "description": "It'd be great if there is an option to add global event handlers. For example - if on 'close' event of all the windows, I want to execute a line of code, I should be able to do something like this:\r\nTi.UI.windowClose = function(e) {\r\n //Do something\r\n}\r\n", "attachment": [], "flagged": false, "summary": "Add global event handlers", "creator": { "name": "nvishnoi", "key": "nvishnoi", "displayName": "Naman Vishoi", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "nvishnoi", "key": "nvishnoi", "displayName": "Naman Vishoi", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "454364", "author": { "name": "nvishnoi", "key": "nvishnoi", "displayName": "Naman Vishoi", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi,\r\n\r\nI think I created the issue in wrong board. Can you move this to Titanium SDK/CLI board ? I don't see that option in the drop down while creating the issue?", "updateAuthor": { "name": "nvishnoi", "key": "nvishnoi", "displayName": "Naman Vishoi", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-20T16:57:19.000+0000", "updated": "2020-02-20T16:57:19.000+0000" }, { "id": "454394", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~nvishnoi] thanks for raising the ticket. Only valid tickets go to the TIMOB project in Jira. This is the inbox so it is the correct location.\r\n\r\nYou can already do global events using {{Ti.App.addEvenListener}} and {{Ti.App.fireEvent}}. You could trigger the event from every window and monitor it at a central place. Something like {{Ti.App.fireEvent(\"closewindow\", payload)}}\r\n\r\nAn even better method of globals events would be using Backbone events, so you don't need to \"cross the bridge\" for every event. See this blog post: https://devblog.axway.com/mobile-apps/global-app-events-in-titanium-using-backbone-js/\r\n\r\nIf this doesn't answer your question, feel free to reply. Otherwise, I think we can close this ticket! \r\n\r\nIn case you're not in the community yet, join it at https://tislack.org. This is a perfect place for a question like this", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-24T10:17:48.000+0000", "updated": "2020-02-24T10:17:48.000+0000" }, { "id": "454397", "author": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "I think [~nvishnoi] is talking about adding an event once and have it run each time a window was opened or closed, without having to add it each time you created a window. I agree that Ti.App.addEventListener and Ti.App.fireEvent should not be used (due to bridge crossing). I am not aware of this being possible with using Backbone events, but maybe I am missing something.\r\n\r\nI think this would be a great feature to add to Alloy as it would only require a few lines of code and would allow even more extensibility.\r\n", "updateAuthor": { "name": "bhouse", "key": "bhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2020-02-24T13:43:30.000+0000", "updated": "2020-02-24T13:43:30.000+0000" }, { "id": "454398", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Oh right, in that case, you could override the {{Alloy.createController}} method, watch for Window closes dynamically and fire a backbone event. Currently, Alloy doesn't have a built-in global event handler, but that could be PR'd in indeed.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-24T14:03:39.000+0000", "updated": "2020-02-24T14:03:47.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }