bianco.events

Modern DOM events helpers written in es2015

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
bianco.events
601.1.12 years ago8 years agoMinified + gzip package size for bianco.events in KB

Readme

bianco.events
!Build Statusci-imageci-url !NPM versionnpm-version-imagenpm-url !NPM downloadsnpm-downloads-imagenpm-url !MIT Licenselicense-imagelicense-url
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.

Usage

import { add, remove, once } from 'bianco.events'

add(node/s, 'click mouseenter', function(e) {
  console.log('tadaaa!')
})

API

Table of Contents

-   [Parameters](#parameters)
-   [Parameters](#parameters-1)
-   [Parameters](#parameters-2)

add

Set a listener for all the events received separated by spaces

Parameters

  • els (HTMLElement \| Array) DOM node/s where the listeners will be bound
  • evList string list of events we want to bind space separated
  • cb Function listeners callback
  • options Object event options (capture, once and passive)

Returns (HTMLElement \| NodeList \| Array) DOM node/s and first argument of the function

once

Set a listener using from a list of events triggering the callback only once

Parameters

string list of events we want to bind space separated
  • cb
  • Function listeners callback
  • options
  • Object event options (capture, once and passive)
    Returns (HTMLElement \| NodeList \| Array) DOM node/s and first argument of the function

    remove

    Remove all the listeners for the events received separated by spaces

    Parameters

    string list of events we want unbind space separated
  • cb
  • Function listeners callback
  • options
  • Object event options (capture, once and passive)
    Returns (HTMLElement \| NodeList \| Array) DOM node/s and first argument of the function