{ "id": "149850", "key": "TIMOB-20030", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-12-10T06:02:14.000+0000", "created": "2015-07-22T13:39:29.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "Community" ], "versions": [], "issuelinks": [], "assignee": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T22:44:24.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h5. Current behavior\r\nWith\r\n{code}\r\nlistView.addEventListener('scrollstart', this.myCallback);\r\n{code}\r\nyou can register an event listener. But there is no check if the listener is already registered.\r\n\r\nSo if you do something like this:\r\n{code}\r\nfunction attach() {\r\n listView.addEventListener('scrollstart', this.myCallback);\r\n}\r\nattach();\r\n\r\n//\r\n// Lots of code or loop or async callback between \r\n//\r\nattach();\r\n\r\n{code}\r\n\r\nyou habe a second registered callback. You have todo something like this to unregister:\r\n{code}\r\nlistView.removeEventListener('scrollstart', this.myCallback);\r\nlistView.removeEventListener('scrollstart', this.myCallback);\r\n{code}\r\n\r\nIts difficult to debug problems around that if you overlooked the second call of addEventListener.\r\n\r\nh5. Expected\r\n- The second listener is not registered\r\n- (optional) Warning or notice that there is already a listener", "attachment": [], "flagged": false, "summary": "iOS: Repeated call of listView.addEventListener('scrollstart') should only result in 1 listener", "creator": { "name": "c.waldmann@yatego.com", "key": "c.waldmann@yatego.com", "displayName": "Christian Waldmann", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "c.waldmann@yatego.com", "key": "c.waldmann@yatego.com", "displayName": "Christian Waldmann", "active": true, "timeZone": "Europe/Berlin" }, "environment": "4.1", "closedSprints": [ { "id": 536, "state": "closed", "name": "2015 Sprint 25 SDK", "startDate": "2015-12-05T01:30:40.415Z", "endDate": "2015-12-19T01:30:00.000Z", "completeDate": "2015-12-29T03:19:42.127Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "372207", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR pending : https://github.com/appcelerator/titanium_mobile/pull/7548. The Hello message should only be displayed ones upon scrollEnd regardless of how many eventListeners are added. \r\n{code} \r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : 'blue',\r\n title : 'Main Window'\r\n});\r\n\r\nvar listView = Ti.UI.createListView();\r\n\r\n function myFunction() {\r\n Ti.API.info(\"Hello\");\r\n }\r\n\r\nvar itemsSection = Ti.UI.createListSection({ headerTitle: 'Items'});\r\nvar itemData = [\r\n {properties: { title: 'Item 1'}},\r\n {properties: { title: 'Item 2'}},\r\n {properties: { title: 'Item 3'}},\r\n {properties: { title: 'Item 4'}},\r\n {properties: { title: 'Item 5'}},\r\n {properties: { title: 'Item 6'}},\r\n];\r\n\r\nlistView.addEventListener(\"scrollend\",myFunction);\r\n\r\nvar addEventButton = Titanium.UI.createButton({\r\n title: 'Add Event',\r\n bottom: 10,\r\n width: 100,\r\n height: 50\r\n});\r\n\r\naddEventButton.addEventListener(\"click\",function(e){\r\nlistView.addEventListener(\"scrollend\",myFunction);\r\n});\r\n\r\nitemsSection.setItems(itemData);\r\nvar sections = [];\r\nsections.push(itemsSection);\r\nlistView.sections = sections;\r\nwin.add(listView);\r\nwin.add(addEventButton);\r\nwin.open();\r\n\r\n{code}", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-12-04T23:00:01.000+0000", "updated": "2015-12-04T23:00:48.000+0000" }, { "id": "372594", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR and FT passed. PR Merged!", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-12-10T06:02:06.000+0000", "updated": "2015-12-10T06:02:06.000+0000" }, { "id": "415155", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T22:44:24.000+0000", "updated": "2017-03-22T22:44:24.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }