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.
- Host: GitHub
- URL: https://github.com/gilbox/simflux-old
- Owner: gilbox
- License: mit
- Created: 2014-11-20T05:29:39.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-20T05:31:13.000Z (over 11 years ago)
- Last Synced: 2025-03-24T05:44:50.188Z (over 1 year ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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