Code Monkey home page Code Monkey logo

adapter's Introduction

@most/adapter

Most.js emphasizes declarative event streams, which have many advantages such as helping to avoid race conditions. However, getting data into a Most.js event stream graph from third-party libraries designed without that approach in mind can be tricky. Often, forcing a library into that model leads to a messy solution.

When You Should Use It

@most/adapter provides a disciplined, imperative API for getting external data into a most.js stream. The goal is to make it simpler to integrate libraries that don’t lend themselves to a declarative approach. @most/adapter works well for cases where you can’t just implement the standard run() interface.

If you are looking to translate Node.js streams into Most.js streams, take a look at the community-provided most-node-streams library.

Get It

npm install --save @most/adapter

yarn add @most/adapter

API

Adapter<A, B>

type Adapter<A, B> = [(event: A) => void, Stream<B>]

An adapter is an entangled pair of an event stream, and a function to induce (cause) events in that stream.

createAdapter :: () → Adapter<A, A>

Create an Adapter.

const [induce, events] = createAdapter<string>()

// Cause an event with value "hello" to occur in events.
induce('hello')
// Cause an event with value "world" to occur in events.
induce('world')

adapter's People

Contributors

dependabot-preview[bot] avatar briancavalier avatar frikki avatar gitusp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.