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

@fnando/pulse

v0.0.7

Published

Pulse is a lightweight JavaScript framework that enhances your HTML rather than replacing it.

Readme

Pulse

Pulse is a lightweight JavaScript framework that enhances your HTML rather than replacing it.

CI NPM NPM MIT License

.

Installation

This package is available as a NPM package. To install it, use the following command:

npm install @fnando/pulse --save

If you're using Yarn (and you should):

yarn add @fnando/pulse

Usage

Creating a controller

A controller encapsulates the logic for a piece of UI. That can be orchestrating multiple components, or a smaller component unit. All controllers must inherit from Controller.

import { Controller } from "@fnando/pulse";

export class Counter extends Controller {
  connect() {
    this.count = 0;
    this.on("increment->click", this.increment);
    this.on("decrement->click", this.decrement);
  }

  increment() {
    this.count += 1;
    this.update();
  }

  decrement() {
    this.count -= 1;
    this.update();
  }

  update() {
    this.target("output").textContent = this.count.toString();
  }
}

A few things about this controller:

  • connect() is a method you can define that will always be called once a new element is connected (added to DOM).
  • Similarly, there's a disconnect() method that's called when the controller's root element is removed. If you're overriding the original method, make sure you call super(), so event handlers are properly cleared up.
  • this.on(expression, callback) will register an event handler on the target. The expression is a shortcut for a target and the event. The above example is defining a click event on [data-counter-target="increment"] and [data-counter-target="decrement"].
  • the update() method is reflecting the new count on the ui. It uses target(name) to retrieve the element. The full selector would be [data-counter-target="output"].

Defining keyboard events

Just like Stimulus, you can define keyboard events mapping specific key combos. The syntax looks like this:

this.on("@window->keydown.ctrl+w", this.close);

Registering controllers

To register a controller, you'll need an application instance.

import { Application } from "@fnando/pulse";
import { Counter } from "./controllers/Counter";

const app = new Application();
app.register("counter", Counter);
app.start();

The Application#start() method will watch for DOM modifications and ensure all controllers are connected to their own elements.

FAQ

This looks like Stimulus... a lot!

Yes, it does! And that's the purpose. It doesn't implement everything, but it implements the things I like about it, so it's lot smaller (2kb min+gzip).

What's not supported?

  • There's no notifications if targets are added/removed (in Stimulus, you can use ${name}TargetConnected and ${name}TargetDisconnected).
  • There's no outlet support to communicate between different controllers.
  • Event's are set using controller.on(expression, callback), not [data-action].
  • No CSS classes or values.

Maintainer

Contributors

  • https://github.com/fnando/pulse/contributors

Contributing

For more details about how to contribute, please read https://github.com/fnando/pulse/blob/main/CONTRIBUTING.md.

License

The gem is available as open source under the terms of the MIT License. A copy of the license can be found at https://github.com/fnando/pulse/blob/main/LICENSE.md.

Code of Conduct

Everyone interacting in the pulse project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.