【文件属性】:
文件名称:branchy:in在单独的过程中执行Node.js函数
文件大小:14KB
文件格式:ZIP
更新时间:2021-05-13 00:10:08
nodejs javascript fork async JavaScript
在一个单独的过程中舒适地运行Node.js函数。
const forkedAsyncFunction = branchy ( heavySyncFunction )
安装
npm install --save branchy
基本用法
这非常简单-将您的函数传递给branchy并获得它的异步,返回Promise的版本:
const branchy = require ( 'branchy' )
// Synchronous "add", returns number
const adder = ( a , b ) => a + b
// Asynchronous "add" in a child process, returns Promise that resolves to number
const forkedAdder = branchy ( adder )
// Don't
【文件预览】:
branchy-master
----.eslintrc.yml(114B)
----package.json(908B)
----.github()
--------dependabot.yml(143B)
--------workflows()
----test()
--------basic.spec.js(2KB)
--------concurrency.spec.js(2KB)
--------modules()
----.prettierrc(288B)
----branchy.svg(2KB)
----LICENSE(1KB)
----.gitignore(3KB)
----lib()
--------context.js(355B)
--------branchy.js(4KB)
--------thread.js(3KB)
----README.md(6KB)
----.editorconfig(146B)