https://github.com/elsehow/frplux
an experiment in making a Flux architecture using FRP
https://github.com/elsehow/frplux
Last synced: about 2 months ago
JSON representation
an experiment in making a Flux architecture using FRP
- Host: GitHub
- URL: https://github.com/elsehow/frplux
- Owner: elsehow
- Created: 2015-06-13T21:39:58.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-27T23:41:39.000Z (over 9 years ago)
- Last Synced: 2024-04-15T07:13:46.081Z (about 1 year ago)
- Language: CoffeeScript
- Size: 363 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# frplux
this is an experiment in making a Flux architecture using FRP techniques.
the core idea is to replace a dispatcher with a single stream.
this is a work in progress. issues and PRs are most welcome.
## overview

ACTIONS push messages over the DISPATCHER stream.
the STORE reacts to messages in the DISPATCHER stream by (1) updating the application state (2) talking to the outside world and (3) pushing the *(entire)* application state over the STATE STREAM whenever there's a change.
the COMPONENT re-draws the entire DOM every time a state comes through the STATE STREAM.
## this repository
this app demonstrates a simple messageboard. it fetches articles from the server, and lets you delete them. for the sake of example, deleting a message takes a second, and has a 50/50 chance of succeeding.
check out `app/messageboard/MessageboardEntry.coffee`. a single, application-wide dispatcher (a Bacon.Bus()) is passed into the module from `app/entry.coffee`, and the Messageboard entrypoint initializes an Actions object and a Store object.
each event in `Store.stateStream` (another Bacon.Bus()) is the application state at a given time. this is what the Messageboard view reacts to.
and, logically enough, the Messageboard triggers actions expoed in Actions.
NB, this isn't a library, there is no library offered here at all. it's just an example of a pattern, with Bacon.Bus() as the implementation.
## setup
make sure you have `node`, `npm`, `gulp` and `coffee`. then just `npm install` and `gulp`. `coffee server.coffee` and go to http://localhost:3000
## developing
`gulp develop` to start the server + listen for changes. `gulp watch` will bundle the js on changes.