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 🙏

© 2025 – Pkg Stats / Ryan Hefner

simplesjs

v1.0.3

Published

Simple and crude event system for javascript/typescript

Readme

SimplES-js

Simple javascript event system for basic interactions with DOM elements

How to use it?

The whole event system has one main instance of SimplES class. We are able to attach as many events to this instance as we want. We can add them at the instantiating:

const blueSquare = document.querySelector('.blue-square');
const redSquare  = document.querySelector('.red-square'); 

const eventSystem = new SimplES([
    {
        element: blueSquare,
        onEvent: function () {
            console.log("Clicked on blue square");    
        }
    },
    {
        element: redSquare,
        onEvent: function () {
            console.log("Clicked on red square");    
        }
    }
]);

And also whenever after instantiating with methods. One of them is attachEvent which simply adds one so called event_pair, which is an object with two properties, element and onEvent (these properties must be named like this).

const blueSquare = document.querySelector('.blue-square');
const redSquare  = document.querySelector('.red-square'); 

const eventSystem = new SimplES();

eventSystem.attachEvent(blueSquare, () => console.log("Clicked on blue square"));
eventSystem.attachEvent(redSquare, () => console.log("Clicked on red square"));

Another way to add events is adding the same function to multiple elements. This can be accomplished with the attachWithSameFunction method.

const buttons = document.getElementsByClassName('buttons');

const eventSystem = new SimplES();

eventSystem.attachWithSameFunction(buttons, () => console.log("Clicked on one of these blue buttons!"));

We can trigger an event when the target of a click is not in the registred events with addEmptyClick. Keep in mind that every call of this method with valid input will override the previous event. When is this useful? For example when the web page has multiple buttons like posts on social network. They have options button which opens a little dialog box, but we want to also close them when the user clicks to another button or when he/she clicks away and then we can use this method.

eventSystem.addEmptyClick(() => console.log("Here is nothing to click on!"));

P.S.: Feel free to expand this tiny library :D