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

fauxflux

v1.0.0-beta.1

Published

Faux (made in imitation) Flux. A Flux Like Application Architecture for Building User Interfaces.

Downloads

30

Readme

FauxFlux (This library is deprecated, and no longer being actively maintained)

Faux (made in imitation) Flux. A Flux Like Application Architecture for Building User Interfaces.

Getting Started

FauxFlux relies on the wonderful MobX JS library - https://github.com/mobxjs/mobx

npm install --save fauxflux mobx

FauxFlux also relies on Promises - supported in all major browsers besides IE

Quick Overview In Code


// Object containing all of the application state.
var store = {
  selectedState: 'New York'
};

// Array of functions that can be dispatched to update the state in the store.
var actions = [
  {
    name: 'update_selectedState',
    action: function (ff, payload) {
      // ff.store; - reference to the store.
      // ff.dispatch; - actions can dispatch other actions.
      // ff.mobx; - reference to the MobX library.

      // The ff.store is a MobX observable, so any property on it
      // can be mutated in place, and any watchers attached to the property
      // will be notified!
      ff.store.selectedState = payload;
    }
  }
];

// Object of option flags 
// useStrict - Allow or disallow changes to the state outside of a MobX action.
// debug - console.log out any action called within the application. Useful for tracking a series of state changes.
var options = {
  useStrict: true, // true by default
  debug: true, // false by default and will be ignored if built with production flag for `NODE_ENV`.
};


var FF = new FauxFlux(store, actions, options);


// Add a watcher onto the selectedState property of the store.
// Every time the property changes, this function will be called.
FF.mobx.autorun(function () {
  console.log('selectedState', FF.store.selectedState);
});

// Simulate some sort of async requests.
setTimeout(function () {
  FF.dispatch('update_selectedState', 'Idaho');
}, 1000);

setTimeout(function () {
  FF.dispatch('update_selectedState', 'Utah');
}, 2000);

// Should result in 
// console.log - 'New York'
// 1 second later
// console.log - 'Idaho'
// 1 more second later
// console.log - 'Utah'

Notice

Be warned! This codebase is still under active development so there are no guarantees the api is set in stone. Look for A v1.0.0 release in the near future.

Demo

Todo MVC implementation using FauxFlux and Incremental Dom ( Demo ). Much of the code was taken from Pete Hunt's Todo MVC React example and modified to use the FauxFlux architecture design. The code for the demo can be viewed here - example.js

Todos

  • [ ] Add documentation describing the architecture.
  • [ ] Add tooling for better debugging.