1. evtd
Event delegation with native events and extended events.
evtd
Package: evtd
Last modified: Sun, 07 Aug 2022 11:41:41 GMT
Version: 0.2.4
License: MIT
Downloads: 92,046

Install

npm install evtd
yarn add evtd

evtd

Event delegation with native events and extended events in a small library.

(Only 300 lines of codes)

Docs

evtd

Basic Usage

 import { on, off } from 'evtd'

function handleClick () {
  console.log('click')
}

// register event
on(window, 'click', handleClick)
on(document, 'click', handleClick)
on(eventTarget, 'click', handleClick)

// evtd has 2 extended events
on(eventTarget, 'clickoutside', handleClick)
on(eventTarget, 'mousemoveoutside', handleClick)

// unregister
const handleClick2 = () => console.log('click2')
on(eventTarget, 'click', handleClick2)
off(eventTarget, 'click', handleClick2)

// capture
on(eventTarget, 'click', handleClick2, true)
off(eventTarget, 'click', handleClick2, true)

License

MIT

Inspired by delegated-events

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin