0.2.1 • Published 8 years ago

predux v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

predux

NPM

predux is an interface for building redux-like streams. It uses reduxer and optionally ES6 proxies (works in Node.js v6.2.1).

example

var predux = require('predux')

var counter = predux.proxy()
counter.increment = (state=0, num=1) => state+num
counter.decrement = (state=0, num=1) => state-num

counter.on('data', function (state) {
  console.log(state)
})

counter.increment() // 1
counter.increment() // 2
counter.decrement() // 1

If you'd rather not use proxies, the following is equivalent to the above.

var counter = predux()
counter.set('increment', (state=0, num=1) => state+num)
counter.set('decrement', (state=0, num=1) => state-num)

counter is an object stream.

install

npm install predux
0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago