fwoker
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

fworker: 使用函数来创建工作线程

可以通过简单的代码,创建可以复用的工作线程,仅允许函数操作

注意

这个创建的函数变量域与外部域是不同的,这意味着你只能像写新代码一样书写它。虽然这样但还是可以传递参数来调用的,这样的方式暂时只能使用require来使用模块,基准为当前process.cwd()目录下的node_modules

例子

const fworker = require("fworker");
let pool = fworker.pool();
pool.exec(
  async (aa) => {
    let axios = require("axios");
    let res = await axios.get("/");
    return res.data;
  },
  ["test"]
);

Readme

Keywords

none

Package Sidebar

Install

npm i fwoker

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

14 kB

Total Files

18

Last publish

Collaborators

  • app_net