mesh.js

utility library for async iterable iterators

  • 所有者: crcn/mesh.js
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

⚠️ 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

主要指标

概览
名称与所有者crcn/mesh.js
主编程语言JavaScript
编程语言JavaScript (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2015-03-25 23:26:47
推送于2018-12-22 16:28:21
最后一次提交2018-12-22 10:28:20
发布数62
最新版本名称8.0.12 (发布于 )
第一版名称0.0.9 (发布于 )
用户参与
星数1k
关注者数15
派生数22
提交数723
已启用问题?
问题数274
打开的问题数5
拉请求数9
打开的拉请求数1
关闭的拉请求数3
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?