An open API service indexing awesome lists of open source software.

https://github.com/gilbox/simflux-old

The original simflux experiment. Useful, but retired for something else.
https://github.com/gilbox/simflux-old

Last synced: 5 days ago
JSON representation

The original simflux experiment. Useful, but retired for something else.

Awesome Lists containing this project

README

          

simflux
=======

simple Flux implementation

how?
----

var Flux = simflux.Flux,
dispatcher = Flux.dispatcher;

// an object qualifies to be a store if it has name and actions
var appStore = {
name: 'appStore',
actions: [ 'addTodo', 'removeTodo' ],
addTodo: function(todo) { ... },
removeTodo: function(todo) { ... }
}

// register appStore with Flux
dispatcher.registerStore(appStore);

// all async ops should be handled by the Action Creator
var actionCreator = {
addTodo: function(todo) {
doSomethingAsync.then(function() {
dispatcher.dispatch('addTodo', todo);
});
}
}

// do something!
actionCreator.addTodo({ todo: 'My Todo' });

why?
----

- Less boilerplate
- Does not facilitate async Stores
- Easily list action dependencies without needing to rely on `waitFor`
- Circular dependency detection
- Tiny footprint

demo
----

[angular-simflux-experiment](https://github.com/gilbox/angular-simflux-experiment): Flux in angularjs

requirements
------------

- lodash