Skip to content

ihasq/wmel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WMEL

WeakMap-based Event Listener.

import { listen } from "wmel"

// Add listener

const abort = listen(
	document.querySelector("#some-button"), // target
	"click",                                // type
	({ target }) => console.log("clicked")  // listener
);


// Abort listener

abort();

Install

npm i wmel

Benchmark

jsPerf shows WMEL is ~60% faster than vanilla addEventListener.

About

WeakMap-based Event Listener

Resources

Stars

Watchers

Forks