npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eventer-js

v0.1.9

Published

Utility for easy events handling

Downloads

14

Readme

eventer

Utility for easy events handling

Installing

You can easily install it as a dependency for your project with npm

npm install eventer-js

Using it

Add event listener

First you'll need to import and then create an Eventer main object, you can pass true to the constructor to tell eventer that you want him to extend the default HTMLElement prototype, this is under param to avoid unwanted behaviour and conflicts with other libraries or tools.

	import {Eventer} from './lib/Eventer/eventer-js';
	var eventer = new Eventer(true);

Then you can access all the four methods exposed by Eventer objects. To bind an event you simply need to call bindEvent this way

	eventer.bindEvent( eventName, DOMElement, eventFunction, useCapture  );

where eventName is the event name to listen to, DOMElement is the non-live DOM instance of the element (usualy retrived with querySelector) and eventFunction is the callback function to trigger when the event is fired, you can also set useCapture as you do in vanilla js. You can also use the on shorthand with the same parameters

Plus, if you have passed true to the constructor you are able to use the eventerOn method directly on the HTMLElement.

	document.querySelector('.bottone').on('click', function() {
		// Your awesome code here...
	}, true);

Remove event listener

If you need to remove event you can use one of these methods

	eventer.unbindEvent( eventName, DOMElement, eventFunction );
	eventer.unbindAll( eventName, DOMElement );
	eventer.clearAll( DOMElement );

or you may rather use the off event, witch is a shorthand for the above three methods, it will handle their call depending on the params type and number

	eventer.off( eventName, DOMElement, eventFunction );
	// or
	eventer.off( eventName, DOMElement );