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

evoflux

v0.2.1

Published

a flux architecture implement

Downloads

71

Readme

evoflux

Installation

npm install evoflux

you must have browserify and it does not support amd.
需要使用browserify,目前暂不支持amd。

Demo

view:

var React = require("react");
var Store = require("../stores/storedemo");
var ComponentDemo = require("../components/componentdemo");
var Actions = require("../actions/actiondemo");
var ViewDemo = React.createClass({
  getInitialState:function(){
    return {data:{title:"demo title"}};
  },
  componentDidMount: function() {
    Store.addChangeListener(function(data) {
      this.setState({
        data: data
      });
    }.bind(this));
  },
  handleChange:function(e){
    Actions.changeTitle(e.target.value);
  },
  render: function() {
    return (
      <ComponentDemo title={this.state.data.title} handleChange={this.handleChange} />
    );
  }

});
module.exports = ViewDemo;

view只需添加Store的监听,调用action的方法即可。

action(actiondemo.js):

var Evoflux = require('evoflux');
module.exports = Evoflux.createAction("demo",{
  changeTitle:function(newTitle){
    superagent.get("url")
      .end(function(err,res){
        this.dispatcher({
          action: "changeTitle",
          data: newTitle
        })
    }.bind(this))
  }
})

this parameters "demo" is namespace and can ignore.
第一个参数不是必须,它是作为命名空间使用。方法里必须有名为action或actionType的属性。

store(storedemo.js):

var Evoflux = require('evoflux');
module.exports = Evoflux.createStore("demo",{
  init:function(){
    this.data={
      title:"default title"
    }
    this.triggerTo={
      action2:"update"
    }
  },
  addChangeListener:function(cb){
    this.on(this.changeEvent,function(){
      cb(this.data);
    }.bind(this));
  },
  actions:{
    changeTitle:function(data){
      this.data.title = data.data;
    },
    action2:function(data){
      this.data = data.data;
    }
  }
})

当store需要监听其他store对应的的action时,给actions里的方法加命名空间。如:

actions:{
    "otherNameSpace.changeTitle":function(data){
      this.data.title = data.data;
    }
  }

this parameters "demo" must be same as createAction; actions.demo_changeTitle name must be same as action value for createAction.
第一个参数是作为命名空间使用,需要与createAction一致。store的actions里的方法对应createAction里的方法,方法名必须与createAction里方法里的action的值一致。当调用action的方法时,stores里actions下与它值一样名称的方法也会触发执行。 actions里的方法默认会触发store的change事件,如果需要触发特定的事件,需要配置在this.triggerTo。key为action名,value为事件名。 勿在actions里的方法直接写this.emit或this.trigger。 store里可用的事件方法:this.on(event,cb)、this.off(event,cb)、this.offAll()