Skip to content

alex2844/js-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

js-events

Add and delete events

var test = e => console.log(e);
document.body.addEventListener('scroll', test);
document.body.addEventListener('click', test, { once: true });
document.body.removeEventListener('scroll', test);
document.body
	.on('scroll', test)
	.on('click', test, { once: true })
	.off('scroll', test);

List events

console.log(
	getEventListeners(document.body)
);
console.table(
	[document, window].concat([...document.querySelectorAll('*')]).map(el => {
		let evs = getEventListeners(el);
		// evs = (evs.click ? { click: evs.click } : []);
		return {
			el: el,
			types: Object.keys(evs).join(', '),
			listeners: evs
		};
	}).filter(item => item.types)
);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published