【文件属性】:
文件名称:node-routine:内联,基于Promise的JS Web Workers包装器
文件大小:92KB
文件格式:ZIP
更新时间:2021-05-17 05:20:09
TypeScript
常规
内联,基于Promise的JS Web Workers包装器
yarn add worker-routine
用法
使用async / await :
import routine from "worker-routine" ;
const inneficientSquare = n => {
let total = 0 ;
for ( let i = 0 ; i < n ; i ++ ) {
for ( let j = 0 ; j < n ; j ++ ) {
total ++ ;
}
}
return total ;
} ;
// spawns two workers running in separate threads
const results = await Promise . all ( [
routine ( inn
【文件预览】:
node-routine-master
----.gitignore(40B)
----routine.ts(939B)
----package.json(799B)
----LICENSE(1KB)
----tsconfig.json(171B)
----README.md(1KB)
----index.html(214B)
----index.ts(62B)
----utils.ts(149B)
----yarn.lock(231KB)