Use modern JavaScript!
EventTarget.addEventListener("click", function() {
// Do something cool
}, {once : true});
A Boolean indicating that the listener should be invoked at most once after being added. If
true
, the listener would be automatically removed when invoked.
All modern browsers support this feature