Skip to content

@Raynos /on.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
var stop = eventTarget.on("event", function optionalFilter(event) {
return event.target.classList.contains("some-class")
}, function listener(event) {
// handle event
})
// stop listening()
stop()
// sugar
function matchesSelector(selector) {
return function (event) {
return event.target.matchesSelector(selector)
}
}
eventTarget.on("event", matchesSelector(".some-class"), listener)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.