{ "id": "61764", "key": "TIMOB-1132", "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": [ { "id": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-15T02:44:53.000+0000", "created": "2011-04-15T02:44:53.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T19:22:12.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": "{html}

I have not been able to get the removeEventListener to work and\nhave included a simple example below.

\n

Basically if you click button one, you get an alert event.\nClicking button two should remove the click eventListener from\nbutton 1.... but its doesn't.

\n
\nvar testButton = Titanium.UI.createButton({\n    top:30,\n    width:100,\n    height:33,\n    title:'button 1'\n});\ntestButton.addEventListener('click', function() {\n    alert('Hello, world!');\n});\n \nvar testButton2 = Titanium.UI.createButton({\n    top:70,\n    width:100,\n    height:33,\n    title:'button 2'\n});\ntestButton2.addEventListener('click', function() {\n    testButton.removeEventListener('click');\n});\n \nwin1.add(testButton);\nwin1.add(testButton2);\n
{html}", "attachment": [], "flagged": false, "summary": "removeEventListener not removing events", "creator": { "name": "rjamesy", "key": "rjamesy", "displayName": "rjamesy", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rjamesy", "key": "rjamesy", "displayName": "rjamesy", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124926", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

You should use code like the following:

\n
\nvar win1 = Ti.UI.createWindow();\n\nvar f = function() {\n    alert('Hello, world!'); \n}\n\nvar testButton = Titanium.UI.createButton({\n    top:30,\n    width:100,\n    height:33,\n    title:'button 1'\n});\ntestButton.addEventListener('click', f);\n \nvar testButton2 = Titanium.UI.createButton({\n    top:70,\n    width:100,\n    height:33,\n    title:'button 2'\n});\ntestButton2.addEventListener('click', function() {\n    testButton.removeEventListener('click',f);\n});\n \nwin1.add(testButton);\nwin1.add(testButton2);\nwin1.open();\n
\n

You are required to pass in a reference to the listener function\nat the time of removal.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:44:53.000+0000", "updated": "2011-04-15T02:44:53.000+0000" }, { "id": "408439", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closed as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-02T19:22:12.000+0000", "updated": "2017-03-02T19:22:12.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }