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

@but212/atom-effect

v0.13.0

Published

A reactive state management library that combines the power of `atom`, `computed`, and `effect` for seamless management of reactive state.

Readme

@but212/atom-effect

npm version License: MIT TypeScript

a signal for reactive state management.

Installation

npm i @but212/atom-effect

CDN

<script src="https://cdn.jsdelivr.net/npm/@but212/atom-effect@latest"></script>
<!-- or -->
<script src="https://unpkg.com/@but212/atom-effect@latest"></script>

Core API

atom(value)

Creates a mutable state container.

  • read: atom.value (tracks dependency)
  • write: atom.value = newValue (triggers effects)
  • peek: atom.peek() (read without tracking)
const count = atom(0);
count.value++;
console.log(count.value);

computed(fn)

Creates a derived value that automatically updates when dependencies change.

  • Lazy evaluation (only computes when read or needed by an effect).
  • Caches result until dependencies change.
const double = computed(() => count.value * 2);

effect(fn)

Runs a function immediately and re-runs it whenever its dependencies change.

  • Returns a dispose function to stop the effect.
const stop = effect(() => {
  console.log(count.value);
});
stop();

batch(fn)

Groups multiple updates and ensures they are flushed synchronously when the function completes.

Note: While the library automatically batches updates using microtasks, batch() is useful when you need to ensure all effects have run immediately after a block of changes.

batch(() => {
  count.value = 1;
  count.value = 2;
}); 
// Effects are guaranteed to have run synchronously here

untracked(fn)

Runs a function without tracking any dependencies accessed within it.

computed(() => {
  // `count` is not tracked as a dependency here
  return untracked(() => count.value * 2);
});

API Reference

Detailed Options

atom(initialValue, options?)

  • name: (string) Debug name.

computed(fn, options?)

  • equal: (fn) Comparison function to skip re-computes.
  • defaultValue: (any) Value to return when pending/error.
  • lazy: (boolean) If true, defers evaluation until read.

effect(fn, options?)

  • sync: (boolean) Runs synchronously on change.
  • onError: (fn) Async error handler.
  • trackModifications: (boolean) Warns on self-writes.

Advanced Usage

Async Computed

const userId = atom(1);
const user = computed(async () => {
  const res = await fetch(`/api/users/${userId.value}`);
  return res.json();
}, { defaultValue: { loading: true } });

Utilities & Development

Type Guards

import { isAtom, isComputed, isReactive } from '@but212/atom-effect';

isAtom(count); // true
isReactive(double); // true

Development Commands

pnpm test        # Run unit tests
pnpm bench       # Run benchmarks
pnpm lint        # Run lint checks
pnpm build       # Build production bundle

Performance

Note: These numbers represent pure engine throughput in isolation. Actual app performance often depends on external factors like DOM updates and layout.

| Operation | Performance | | --- | --- | | Atom creation (x1000) | ~13.9K ops/sec | | Atom read (x1000) | ~38.1K ops/sec | | Atom write (x1000) | ~343K ops/sec | | Computed creation | ~2.17M ops/sec | | Computed recomputation | ~564K ops/sec | | Effect execution | ~2.78M ops/sec | | Batched updates (x2) | ~3.97M ops/sec | | Deep chain (100 levels) | ~8.16K ops/sec |

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

MIT © Jeongil Suk