0.7.0 • Published 8 years ago
fux v0.7.0
fux
Fux is a user interface library with uni-directional dataflow.
Install
NPM
npm install --save-dev fux
Starter Project
- download example.zip from Github
- extract and run
npm run dev
- this starts a minimal build process with preconfigured babel and browserify
- point your browser to localhost:8080 to view the examples
- or use this as template for your own project
Usage
import { element, cycle, views, scopes, decorators } from 'fux';
const { component, controller, dispatchChangeSets } = decorators;
const App = component(
dispatchChangeSets(),
controller({
inc: ['/count', count => count + 1]
}),
)(function({ context }) {
return (
<div>
<input type='button' onClick='inc'/>
{context.get('/count')}
</div>
);
});
const view = views.dom(document.body, App);
const scope = scopes.value({ count: 0 });
cycle(view, scope);
Architecture
- Context
- immutable data structure (struct)
- holds application context
- emitted from scopes, when they have new data
- consumed from views
- PatchSet
- list of json patch objects
- used like actions in flux architecture
- used to manipulate Context
- emitted from views, when they change state
- consumed from scopes
- Scope
- state container
- representation of data that may change over time (stream)
View
- passes context to deku component
- render component to DOM
- component may dispatch PatchSet on user interaction
- available views
- fux.views.dom
- stateless
- dispatches side effects to scopes
- additional functionality added through decorators
Api
fux
fux.scopes
fux.views
fux.decorators
Hack
git clone https://github.com/freemountain/fux
cd fux
npm install
npm run dev
... and click here
License
The MIT License (MIT)
0.7.0
8 years ago
0.0.12
8 years ago
0.0.10
8 years ago
0.0.17
8 years ago
0.0.16
8 years ago
0.0.15
8 years ago
0.0.14
8 years ago
0.0.9
8 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.5
8 years ago
0.0.4
8 years ago
0.0.2
8 years ago
0.6.10
8 years ago
0.6.9
8 years ago
0.6.8
8 years ago
0.6.7
8 years ago
0.6.6
8 years ago
0.4.0
8 years ago
0.0.3
8 years ago
0.0.1
8 years ago
0.1.0
9 years ago