{ "id": "163965", "key": "TIMOB-24038", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2016-10-16T16:34:35.000+0000", "created": "2016-10-14T07:13:24.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T23:13:49.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": [], "description": "I'd like to suggest the implementation of jQuery like event setters for Ti.UI.* elements, like:\r\n\r\n`on()`\r\n`once()`\r\n`off()`\r\n\r\nVersus the current functions:\r\n`addEventListener()`\r\n`removeEventListener()`\r\n\r\nThese functions would then apply on every *Ti.UI.xxx* element. This setup has currently already been implemented on controllers and it is imho cleaner and provides some better functionality (especially `off()` and `once()`).\r\n", "attachment": [], "flagged": false, "summary": "Ti.UI elements: Usage of on() in favour of addEventListener()", "creator": { "name": "creative_jira_user", "key": "uzbbert", "displayName": "Creative", "active": false, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "creative_jira_user", "key": "uzbbert", "displayName": "Creative", "active": false, "timeZone": "Europe/Amsterdam" }, "environment": "Ti <= 5.5.1.GA and Alloy <= 1.9.1 (so any version as of date)", "comment": { "comments": [ { "id": "398998", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Thanks for submitting the request. Our engineers will consider it. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-10-14T20:10:52.000+0000", "updated": "2016-10-14T20:10:52.000+0000" }, { "id": "399040", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "In general, I like this idea. If would \"only\" rename it, there shouldn't be any trouble. We would also need to change the way Alloy works, update all unit-tests, update our new module templates, and deprecate the old way for at least one major version. So it *could* be considered for 6.1.0 / 6.2.0 and remove it in 7.0.0 / 8.0.0 or we allow them to live along with each other, since we only change the public API. \r\n\r\nBut for the next releases, we want to primary focus on bug fixes, rather then introducing new features and behaviors, so we won't schedule it for a concrete version for now. Thanks!\r\n\r\n*EDIT*: And if we go with \"on\" and \"off\", we should also replace \"fireEvent\" with \"emit\", right? \r\n\r\nI made a proof-of-concept [here|https://github.com/appcelerator/titanium_mobile/compare/master...hansemannn:TIMOB-24038] that replaces the above mentioned methods on iOS and it works as expected. The same needs to be done for Android of course.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-10-15T13:05:04.000+0000", "updated": "2016-10-16T12:29:23.000+0000" }, { "id": "399050", "author": { "name": "creative_jira_user", "key": "uzbbert", "displayName": "Creative", "active": false, "timeZone": "Europe/Amsterdam" }, "body": "I guess you could even go with the backbone setup, see:\r\nhttp://backbonejs.org/#Events\r\n\r\non(), once(), off(), trigger() ...\r\n\r\n\r\nOne way to tackle this improvement is to search for all 'addEventListener' occurrences and determine whether it's worth it to replace it. In any case, the aim would be to create a uniform API for events (so it would make sense to go with the Backbone Dispatcher, since its already used within backbone). If all could work on the existing backbone dispatcher code then that would be awesome.\r\n\r\n", "updateAuthor": { "name": "creative_jira_user", "key": "uzbbert", "displayName": "Creative", "active": false, "timeZone": "Europe/Amsterdam" }, "created": "2016-10-16T12:50:37.000+0000", "updated": "2016-10-16T12:50:37.000+0000" }, { "id": "399051", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "{{once()}} would be a new feature that introduces a new behavior. {{emit()}} is very known in the NodeJS area, so I used that for now. But as said before, we will put it on hold for now.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-10-16T16:10:49.000+0000", "updated": "2016-10-16T16:10:49.000+0000" }, { "id": "399201", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Marking as Duplicate of TIMOB-18039 (thx [~uzbbert] and [~michael])", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-10-18T07:57:52.000+0000", "updated": "2016-10-18T07:57:52.000+0000" }, { "id": "414666", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate with reference to the above comments and links.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T23:13:49.000+0000", "updated": "2017-03-21T23:13:49.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }