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

@fobx/core

v0.10.2

Published

Fast, reactive state management

Downloads

50

Readme

@fobx/core

Getting Started

The behavior of @fobx/core is almost identical to that of mobx with respect to the critical path of behavior. Meaning it passes all of the mobx unit tests with respect to observable values, computed values, reactions and transactions (once API differences have been accounted for).

Because of this functional equivalence, almost all of the mobx documentation and stack overflow questions found for mobx are applicable to @fobx/core. The following are the notable differences that are needed in order to get started:

  1. Fobx has two methods for creating observable state, observable and observableBox functions.

    import { observable, observableBox } from "@fobx/core"
    
    const num = observableBox(1)
    const str = observableBox("hello fobx")
    const bool = observableBox(true)
    const arr = observable([1, 2, 3])
    const map = observable(
      new Map([
        ["a", "a"],
        ["b", "b"],
      ]),
    )
    const set = observable(new Set([1, 2, 3]))
    const obj = observable({ a: 1, b: 2 })
    class A {
      a = 1
      constructor() {
        this.b = 2
        // acts like mobx's makeAutoObservable
        observable(this)
      }
    }
  2. observableBox is needed when making a primitive type observable. When this happens you get and set the value through the .value property.

    import { observableBox } from "@fobx/core"
    
    const a = observableBox(1)
    console.log(a.value) // prints 1
    a.value = 5
    console.log(a.value) // prints 5
  3. Observable values are tracked immediately instead of waiting until the end of the reaction body.

    const o = observableBox(0);
    const seen: number[] = [];
    
    autorun(() => {
       seen.push(o.value);
       if (o.value < 3) o.value += 1;
    });
    
    console.log(seen); // prints [0,1,2,3] ... mobx will have [0]
    o.value += 1;
    console.log(seen) // prints [0,1,2,3,4] ... mobx will have [0,2,3,4]

TODO List

  1. observableObject needs to handle property add + delete?
  2. Find and address any TODO: comments in the code.

Notes

  1. Array functions with callbacks (filter, forEach, every, etc...) return the non-proxied array as the 3rd argument of the callback instead of the proxy. This is for performance related reasons. Consumers have access to the proxied array (they're calling the function on it) if they need to do something with.