[TIMOB-1132] removeEventListener not removing events
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2011-04-15T02:44:53.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 1.5.0 |
| Components | iOS |
| Labels | n/a |
| Reporter | rjamesy |
| Assignee | Reggie Seagraves |
| Created | 2011-04-15T02:44:53.000+0000 |
| Updated | 2017-03-02T19:22:12.000+0000 |
Description
I have not been able to get the removeEventListener to work and have included a simple example below.
Basically if you click button one, you get an alert event. Clicking button two should remove the click eventListener from button 1.... but its doesn't.
var testButton = Titanium.UI.createButton({
top:30,
width:100,
height:33,
title:'button 1'
});
testButton.addEventListener('click', function() {
alert('Hello, world!');
});
var testButton2 = Titanium.UI.createButton({
top:70,
width:100,
height:33,
title:'button 2'
});
testButton2.addEventListener('click', function() {
testButton.removeEventListener('click');
});
win1.add(testButton);
win1.add(testButton2);
You should use code like the following:
You are required to pass in a reference to the listener function at the time of removal.
Closed as invalid.