0.3.0 • Published 7 years ago

scaleflow v0.3.0

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

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