scaleflow
v0.3.0
Published
Tools and convention to create composeable apps
Downloads
8
Maintainers
Readme
ScaleFlow
ScaleFlow is simple framework based on Stamp Specification and Redux like data flow
Install
$ npm install scaleflow
Usage
const { Core } = require('scaleflow')
const loggerInitializer = (options, { instance }) => {
return Object.assign(instance, {
log: (...args) => instance.dispatch({
type: 'LOG',
payload: [`${options.name || 'LOG'}:`].concat(args)
})
})
}
const loggerMiddleware = core => next => action => {
if (action.type === 'LOG') {
console.log(...action.payload)
}
return next(action)
}
let MyCore = Core
.init(loggerInitializer)
.middleware(loggerMiddleware)
let myCore = MyCore({ name: 'MyCore' })
myCore.log('Hello world!') // MyCore: Hello world!
API
TODO