Browse Source

no message

feature/v2.0
xpz2018 4 years ago
parent
commit
ff3bfcfc63
1 changed files with 5 additions and 9 deletions
  1. 14
      workers/process.js

14
workers/process.js

@ -1,13 +1,9 @@
// worker的优化计算
const math = require('../utils/math')
worker.onMessage(function(res){
console.log('这是worker内部线程打印的')
console.log(res)
let sum = add(res.x,res.y);
worker.postMessage({
sum : sum
})
});
function add(x, y){
return x + y;
}
let sum = math.plus(res.x, res.y)
worker.postMessage({ sum : sum })
})
Loading…
Cancel
Save