Instantly share code, notes, and snippets.

Embed
What would you like to do?
addEventListenerで無名関数をセットした際に、無名関数内でそのイベントをremoveEventListenerする
var btnEl = document.getElementById('btn');
btnEl.addEventListener('click', function(e) {
var target = e.currentTarget;
//btnElに指定したイベントをremove
target.removeEventListener('click', arguments.callee, false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment