【文件属性】:
文件名称:workerize::building_construction:在Web Worker中运行模块
文件大小:5KB
文件格式:ZIP
更新时间:2021-02-23 04:59:46
web-worker threading web-workers JavaScript
:sparkling_heart: 使用Webpack? 您需要
工人化
将模块移动到Web Worker中,自动将导出的功能反映为异步代理。
将微型的专用RPC实现捆绑到您的应用中
如果导出的模块方法已经异步,则签名不变
支持同步和异步工作程序功能
与async / await完美搭配
压缩后的ES3仅800字节
安装
npm install --save workerize
用法
传递函数或包含代码的字符串。
worker.js :
let worker = workerize ( `
export function add(a, b) {
// block for half a second to demonstrate asynchronicity
let start = Date.now();
while (Date.now()-start < 500);
return a + b;
【文件预览】:
workerize-master
----loader.js(240B)
----src()
--------index.js(3KB)
----.travis.yml(59B)
----README.md(1KB)
----.editorconfig(236B)
----.gitignore(52B)
----demo.html(495B)
----package.json(1KB)
网友评论
相关文章
- workerize-loader::building_construction:自动将模块移至Web Worker(Webpack加载器)
- angular-in-web-worker:在Web Worker中运行AngularJS 1.x
- bundle-angular-for-web-worker:打包Angular 1.x以在Web Worker中运行
- portfolio:建筑:construction::building_construction::construction_worker::construction::building_construction::construction_worker: