Modern DOM events helpers written in es2015
This script will not be transpiled and it is only thought to be part of your build chain.
import { add, remove, once } from 'bianco.events'
add(node/s, 'click mouseenter', function(e) {
console.log('tadaaa!')
})
Set a listener for all the events received separated by spaces
els
(HTMLElement | Array) DOM node/s where the listeners will be boundevList
string list of events we want to bind space separatedcb
Function listeners callbackoptions
Object event options (capture, once and passive)
Returns (HTMLElement | NodeList | Array) DOM node/s and first argument of the function
Set a listener using from a list of events triggering the callback only once
els
(HTMLElement | Array) DOM node where the listeners will be boundevList
string list of events we want to bind space separatedcb
Function listeners callbackoptions
Object event options (capture, once and passive)
Returns (HTMLElement | NodeList | Array) DOM node/s and first argument of the function
Remove all the listeners for the events received separated by spaces
els
(HTMLElement | Array) DOM node/s where the events will be unbindevList
string list of events we want unbind space separatedcb
Function listeners callbackoptions
Object event options (capture, once and passive)
Returns (HTMLElement | NodeList | Array) DOM node/s and first argument of the function