1. bianco.events
Modern DOM events helpers written in es2015
bianco.events
Package: bianco.events
Created by: biancojs
Last modified: Mon, 13 Jun 2022 04:35:18 GMT
Version: 1.1.1
License: MIT
Downloads: 1,099
Repository: https://github.com/biancojs/events

Install

npm install bianco.events
yarn add bianco.events

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code