{ "id": "151579", "key": "TIMOB-19641", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": null, "resolutiondate": null, "created": "2015-09-29T16:05:11.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "listeners" ], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-02-28T19:55:46.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": [ { "id": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "Sometimes would be really useful to know if there is an event attached to an object.\r\n\r\nFor example, let's say we want to attach *Ti.App.addEventListener('app:whatever', myfunction)* but, to avoid double attach, we want to check previously if it is not attached yet.\r\n\r\nSomething like *Ti.App.hasListener('app:whatever')* would be really useful to do a check before attach.\r\n\r\nP.d.- I know *Ti.App.add...* is not recommended, but sometimes is better than other possibilities.", "attachment": [], "flagged": false, "summary": "Create a function to check for an existing listener", "creator": { "name": "mcvendrell", "key": "mcvendrell", "displayName": "Manuel Conde Vendrell", "active": true, "timeZone": "Europe/Madrid" }, "subtasks": [], "reporter": { "name": "mcvendrell", "key": "mcvendrell", "displayName": "Manuel Conde Vendrell", "active": true, "timeZone": "Europe/Madrid" }, "environment": null, "comment": { "comments": [ { "id": "373451", "author": { "name": "hazemkhaled", "key": "hazemkhaled", "displayName": "Hazem Khaled", "active": true, "timeZone": "Europe/Istanbul" }, "body": "+1", "updateAuthor": { "name": "hazemkhaled", "key": "hazemkhaled", "displayName": "Hazem Khaled", "active": true, "timeZone": "Europe/Istanbul" }, "created": "2015-12-23T08:26:51.000+0000", "updated": "2015-12-23T08:26:51.000+0000" }, { "id": "373455", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Would love to see this implemented. Currently the only way to prevent double binding, is try and remove it first...", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-12-23T10:56:24.000+0000", "updated": "2015-12-23T10:56:24.000+0000" }, { "id": "373588", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-12-29T03:49:51.000+0000", "updated": "2015-12-29T03:49:51.000+0000" }, { "id": "373596", "author": { "name": "mcvendrell", "key": "mcvendrell", "displayName": "Manuel Conde Vendrell", "active": true, "timeZone": "Europe/Madrid" }, "body": "If double binding if fixed with this solution, of course could be a valid solution (I suppose the fix would be for iOS/Android/WP and for all listeners).\r\n\r\nCannot imagine right now any case in that a user could need a double binding for the same listener. But if that case exists, then a check function would be the real solution.", "updateAuthor": { "name": "mcvendrell", "key": "mcvendrell", "displayName": "Manuel Conde Vendrell", "active": true, "timeZone": "Europe/Madrid" }, "created": "2015-12-29T09:05:11.000+0000", "updated": "2015-12-29T09:05:11.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }