This module aims to ease building middleware DSL's. It implements a basic functional reactive programming Interface.
$ npm install frp-middelware --save
let stream = new SomeStream()
stream.map(data => data + '!!!') // => hello world!!!
.fork(data => data + '???') // => hello world!!!???
.map(data => data + '...') // => hello world!!!...
// invokes the stream
stream.subscribe()
import Middleware from 'frp-middleware'
class SomeStream extends Middleware {
subscribe() { // or you could use the 'emit' method. it is the same thing
const middleware = super.subscribe()
setIntervall(() => middleware('hello world'), 500)
}
}
changes the data in the stream and passes the altered data to the next function in the pipeline
Forks a stream and applies a function to it. The child stream runs independently of the parent stream.
Returns the middleware function Should be implemented as a way to start listening to the stream.
Returns the middleware function. Should be implemented as a way to fire events on the stream.