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 🙏

© 2024 – Pkg Stats / Ryan Hefner

epoxyjs

v0.7.0

Published

Proxy-based reactive library for Javascript and Typescript

Downloads

11

Readme

Epoxy JS

The reactive glue that binds web apps together. Epoxy is a lightweight library for building reactive data models.

Build Status

What is it?

Epoxy extends the two core Javascript data structures – Objects and Arrays – to add built-in change detection and access tracking. Epoxy also provides tools to automatically respond to changes in these data structures, giving you the flexibility to build whatever kind of reactive app you want.

import {makeListenable, computed} from 'epoxyjs';

const score = makeListenable({
    hits: 10,
    multiplier: 4,
});

const totalScore$: Observable<number> = computed(
    () => score.hits * score.multiplier);
    
// totalScore$ will update whenever score.hits or score.multiplier are modified.

Play with this sample code on runkit!

Why is it?

Epoxy is designed to be the backbone of your entire app. Other reactive methodologies focus only on the UI portion of your code, leaving your business logic to use its own imperative paradigm. This inevitably leads to problems where what the user sees doesn't exactly match the underlying state of the app. Even the best code written in this manner will likely end up with a large amount of boilerplate 'adapter' logic designed to translate imperative function calls and responses into some sort of reactive format for the frontend to consume. Epoxy's solution is simple:

Build your entire app around one core, reactive data model!

Your business logic makes changes to the state of the app, your UI responds – no boilerplate, no adapters, no falling out of sync. Where other frameworks prioritize immutability, Epoxy politely scoffs at it. Epoxy applications have one single source of truth, one core data model instance, that changes when the state of the app changes. No juggling instances, no making copies, no funky custom data structures. In fact, that brings us to perhaps the most important feature of Epoxy.

Epoxy data structures are Javascript data structures.

Epoxy uses proxies behind the scenes so the objects and arrays it produces are literally just standard Javascript objects and arrays. It does this without extending the global array or object implementations, so we won't end up with another smoosh-gate. All of this means that Epoxy works with pretty much every Javascript library ever written.

Why not MobX?

Epoxy is similar to MobX but with some notable advantages:

  • Epoxy uses ES6 Proxy objects instead of explicit getters and setters – making it smaller, more compatible, and more efficient.
  • Epoxy is interoperable with rxjs Observables.
  • Epoxy has a deeper API that lets developers respond to specific mutations.
  • Epoxy is designed with easier debugging in mind.

Credit where credit is due: MobX has significantly better browser support than Epoxy.

Why not Redux?

Redux is great for large apps with large development teams that require a lot of enforced structure, but it's generally kind of a pain to use and prevents fast prototyping. All of Redux's best debugging features, like the time-travel debugger, are also possible with Epoxy. In fact, Redux-like patterns are possible in Epoxy for teams that desire more structure. Essentially, Redux enforces a structure that makes bad code good and great code, well, also good. Epoxy doesn't enforce anything, so your great code can be great! Also your bad code will stay bad so, be careful.

How do I start?

npm install --save epoxyjs

Epoxy depends on only rxjs core and the library itself is only about 1000 lines of javascript code, so it won't have a substantial impact on the code size of your project.

The Epoxy Objects and Epoxy Arrays pages are good places to start learning how to use the library.