Skip to content

biancojs/events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3ddf428 · Jan 23, 2023

History

38 Commits
Mar 9, 2022
Sep 17, 2016
Sep 13, 2016
Sep 12, 2016
Jan 23, 2023
Mar 30, 2022
Jun 3, 2018
Mar 30, 2022
Mar 9, 2022
Jun 3, 2018
Dec 1, 2018

Repository files navigation

bianco.events

Build Status NPM version NPM downloads MIT License

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

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

  • els (HTMLElement | Array) DOM node 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

remove

Remove all the listeners for the events received separated by spaces

Parameters

  • els (HTMLElement | Array) DOM node/s where the events will be unbind
  • evList 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

About

Modern DOM events helpers written in es2015

Resources

License

Stars

Watchers

Forks

Packages

No packages published