scaleflow

0.3.0 • Public • Published

ScaleFlow

npm Travis Coveralls Gemnasium JavaScript Style Guide

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

License

MIT © Viatliy V. Makeev

Package Sidebar

Install

npm i scaleflow

Weekly Downloads

3

Version

0.3.0

License

MIT

Last publish

Collaborators

  • wmakeev