【文件属性】:
文件名称:web-threads:使用Web Worker进行Web的通用线程
文件大小:94KB
文件格式:ZIP
更新时间:2021-05-19 19:05:45
ui promise parallel multithreading webworker
使用Web Worker进行Web的通用线程
安装
使用npm install web-threads --save或yarn add web-threads添加它到您的项目中yarn add web-threads
用法
带参数的简单功能
import { execute } from 'web-threads'
let func = ( value ) => {
return value * value
}
let params = {
fn : func . toString ( ) ,
args : [ 2 ]
}
execute ( params )
. then ( console . log )
. catch ( console . error )
具有上下文功能
import { execute } from 'web-thr
【文件预览】:
web-threads-master
----.travis.yml(260B)
----rollup.config.js(355B)
----FUNDING.yml(65B)
----package.json(2KB)
----upgrade.sh(508B)
----test()
--------unit()
--------integration()
----LICENSE(1KB)
----examples()
--------rollup.config.js(238B)
--------index.js(780B)
--------example-class.js(316B)
--------example-context-args.js(315B)
--------index.html(318B)
--------index-cjs.js(4KB)
--------example-function.js(191B)
--------example-context.js(290B)
----.gitignore(919B)
----lib()
--------web-threads.js(689B)
--------worker.js(581B)
----README.md(3KB)
----yarn.lock(216KB)