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

plux

v0.0.3

Published

vanilla flux implementation with an elegant API

Readme

Plux

Plux is a simple, vanilla implementation of facebook's flux with an elegant API. Plux makes writing flux apps easy and fun.

Plux aims to eliminate most or all of the boilerplate typically involved in using the flux architecture.

Stores

Writing stores with plux is super easy. Just use actions to handle stuff from the dispatcher, and methods to expose data to components.

No more big hairy switch statements. Declaratively reconcile events from the dispatcher by providing a map of { ACTION_NAMES: handlerFunctions } as actions and a callback will automatically be registered with the dispatcher.

var store = require('plux').store
var _seconds = 0;

var ClockStore = module.exports = store({
  actions: {
    "TIME_CHANGED": function(payload) {
      _seconds++;
    }
  },
  methods: {
    getSeconds: function() {
      return _seconds
    }
  }
})

Component mixins

Subscribing a component to updates from a plux store is ridiculously simple.

Here's a complete component that re-renders on every change in the store from the above section.

var ClockStore = require('../stores/ClockStore.js')
var React = require('react');

var _getState = function() {
  return {
    time: ClockStore.getSeconds()
  }
}

var Clock = React.createClass({
  mixins: [
    ClockStore.mixin(_getState)
  ],
  render: function() {
    return (
      <div>
        {this.state.time}
      </div>
    );
  }
});

module.exports = Clock;

Simply pass a function that returns the component's complete state to the mixin, and plux will handle the rest.

Dispatcher

Since flux apps should only contain a single dispatcher, plux includes an instantiated flux dispatcher. Stores use this by default unless you specify a different dispatcher for them to use.

var dispatcher = require("plux").dispatcher  // automatically instantiated, ready to go.

dispatcher.dispatch({
  actionType: "TIME_CHANGED",
  foo: "bar"
})

API reference

var plux = require("plux")

var s = plux.store(opts={})

Available properties for opts:

  • actions : action names as keys, payload handler functions as values.
  • methods : methods to expose to consumers of the store.
  • dispatcher : flux dispatcher instance with which to register the callback. optional, uses plux.dispatcher by default.
  • actionPivot : key used to identify the action type. defaults to "actionType".
  • waitFor : [dispatchToken]

Props on s:

  • EventEmitter's methods.
  • dispatchToken : token returned from registering the store's callback with the dispatcher.
  • addChangeListener(func) : add listener when store changes.
  • removeChangeListener(func) : remove listener, duh.
  • mixin(stateGetter) : handle all re-rendering logic for the component. just provide a function that gets all of that component's state.
  • all the methods you put in opts.methods.

Meta

License

MIT

Credits

Plux is developed by SEND in Seattle. We're hiring! Email us at [email protected]