You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/08/01 12:32:36 UTC
[GitHub] [cordova-android] breautek commented on issue #795:
document.removeEventListener is invalid
breautek commented on issue #795: document.removeEventListener is invalid
URL: https://github.com/apache/cordova-android/issues/795#issuecomment-517266533
```javascript
document.addEventListener("backbutton", () => {
console.log("addEventListener backbutton ############");
});
document.removeEventListener("backbutton", () => {
console.log("removeEventListener backbutton ############");
});
```
In javascript, you are creating two different functions here, if you want to remove a listener, you need to keep a reference to it.
```javascript
var listener = () => {
console.log("addEventListener backbutton ############");
};
document.addEventListener("backbutton", listener);
// ... sometime later?
document.removeEventListener("backButton", listener);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org