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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@leonardoraele/signals

v0.5.0

Published

Signal implementation with client-provided scheduler.

Readme

Signals

NPM Version

My own implementation of JavaScript signals, with transparent effect scheduling.

This is intended for apps not based on frontend frameworks that still want to use signals to track state dependencies.

Features

  • Transparent Effect Scheduling: You decide when effects run, which can be immediately, or later.
  • Lazy Computed States. Computed states are evaluated only when needed.
  • Supports AbortSignal. It can be used to dispose of effects.
  • TypeScript Support: Fully typed.

Installation

npm install @leonardoraele/signals

Usage

State

A State is a wrapper over a value, and it emites events when the value changes.

import { State } from '@leonardoraele/signals';

const state = new State(1);

console.log(state.value); // 1

state.events.on('change', (newValue, oldValue) => {
	console.log({ newValue, oldValue });
});

state.value = 2; // { newValue: 2, oldValue: 1 }

Computed States

Create computed states by combining one or more other states. Computed states are automatically updated when their dependencies change. The function runs lazily, only when the value property is accessed.

import { State, Computed } from '@leonardoraele/signals';

const state = new State(2);
const computed = new Computed(() => state.value * 2);

console.log(computed.value); // 4

state.value = 3;

console.log(computed.value); // 6

You can also create computed states that depend on other computed states.

const state = new State(2);
const double = new Computed(() => state.value * 2);
const textValue = new Computed(() => String(double.value));

Effects

Effects are functions that automatically track change of the values they depend on. When the value of a dependency changes, it is said that the effect becomes dirty.

import { State, Effect } from '@leonardoraele/signals';

const message = new State('Signals are cool');
const effect = new Effect(() => console.log(message.value)); // Prints the message immediately

// Later on, call `effect.reevaluate()` and the effect function will rerun
// only if the effect is dirty.

effect.reevaluate(); // Prints the current value of `message`, if it has changed.

// Alternativelly, you can listen to `dirty` updates to be notified when
// dependencies change:

effect.events.on('dirty', () => console.log(message.value)); // Prints the new message immediately when it changes.

Alternatively, if you want the effect to run immediately, you can use the Effect.createImmediate function:

const message = new State('Signals are cool');
Effect.createImmediate(() => console.log(message.value)); // Reruns whenever the message changes, asynchronously.

API Reference

TBD (for now, refer to the *.d.ts typing files)

License

This project is licensed under the MIT License. See the LICENSE.txt file for the license's full text.