You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

frp-middleware

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frp-middleware

an abstraction for adding minimal functional reactive middleware functionality

0.0.5
latest
Source
npmnpm
Version published
Weekly downloads
6
20%
Maintainers
1
Weekly downloads
 
Created
Source

FRP Middelware

Build Status

This module aims to ease building middleware DSL's. It implements a basic functional reactive programming Interface.

Installation

$ npm install frp-middelware --save

Usage

how to use an Stream

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()

how to write your own Stream

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)
  }
}

API

#map

changes the data in the stream and passes the altered data to the next function in the pipeline

#fork

Forks a stream and applies a function to it. The child stream runs independently of the parent stream.

#subscribe

Returns the middleware function Should be implemented as a way to start listening to the stream.

#emit

Returns the middleware function. Should be implemented as a way to fire events on the stream.

Examples

plain-tcp

Keywords

middleware

FAQs

Package last updated on 17 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts