From ff3bfcfc632f1a59682db44e8f9537c7d285539f Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Tue, 8 Jun 2021 19:59:23 +0800 Subject: [PATCH] no message --- workers/process.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/workers/process.js b/workers/process.js index c47cc2f..3ddd6d5 100644 --- a/workers/process.js +++ b/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; -} \ No newline at end of file + let sum = math.plus(res.x, res.y) + worker.postMessage({ sum : sum }) +}) \ No newline at end of file