just-on
v1.1.0
Published
Just the event module of jQuery
Downloads
10
Maintainers
Readme
just-on
Just the event module of jQuery
why?
If you are passionate about developing JavaScript plugins and want to get rid of jQuery, but also enjoy its use of event binding, then this library is very useful for you, which is also its main use case
install
$ npm i -D just-on
usage
import { on, off, one } from 'just-on'
// bind an event once
one('#btn', 'mouseenter', function () {
console.log('Mouse movement only takes effect once')
})
//bind click event
on('#btn', 'click', function () {
console.log('binded!')
})
//remove click event
off('#btn', 'click')
We just placed the selector parameter in the first position of the method here