mesh.js

utility library for async iterable iterators

  • Owner: crcn/mesh.js
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

⚠️ This library is no longer maintained, and should not be used in production applications.

Build Status Coverage Status Join the chat at https://gitter.im/crcn/mesh.js

Mesh is a utility library for async iterable iterators.

Motivation

This library was originally created to handle complex data flows, and unify how applications communicate internally and externally. It also serves as a single channel for all communication which makes it more easy to control & reason about how your application is passing around data asynchronously.

Mesh provides a set of higher order functions that you can use to build your data flows out. Here's an example of that:

import { when, wrapAsyncIterableIterator, fallback } from "mesh";
import { 
  DS_FIND, 
  DS_INSERT, 
  DS_REMOVE, 
  DS_UPDATE, 
  dataStore, 
  DSFindMessage,
  whenCollection,
  DSInsertMessage,
  DSRemoveMessage,
  DSUpdateMessage,
} from "mesh-ds";

const insertTodoItem = (message: DSInsertMessage) => (
  wrapAsnycIterableIterator(fetch('/api/todos', {
    method: 'POST',
    body: message.data
  }))
);

const insert = fallback(
  whenCollection('todos', insertTodoItem),

  // more collections below
  // whenCollection('users', insertUser),
  // whenCollection('items', insertItem),
);

const dsDispatch = dataStore({
  [DS_INSERT] : insert,

  // other operations - similar code to insert
  //[DS_REMOVE] : remove,
  //[DS_UPDATE] : update,
  //[DS_FIND]   : find
});

Installation

NPM: npm install mesh
Bower: bower install mesh

Resources

Main metrics

Overview
Name With Ownercrcn/mesh.js
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2015-03-25 23:26:47
Pushed At2018-12-22 16:28:21
Last Commit At2018-12-22 10:28:20
Release Count62
Last Release Name8.0.12 (Posted on )
First Release Name0.0.9 (Posted on )
用户参与
Stargazers Count1k
Watchers Count15
Fork Count22
Commits Count723
Has Issues Enabled
Issues Count274
Issue Open Count5
Pull Requests Count9
Pull Requests Open Count1
Pull Requests Close Count3
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private