diff --git a/index.js b/index.js index d203fc7..4fb5edd 100644 --- a/index.js +++ b/index.js @@ -10,6 +10,8 @@ const io = new Server(3069) io.on('connection', (socket) => { let worker + let isFirst = true + function reset () { worker = new Worker(path.join(__dirname, 'vm.js')) @@ -25,6 +27,11 @@ io.on('connection', (socket) => { break } }) + + // ohio + if (!isFirst) { + worker.postMessage({ type: 'setFunctions', jsonArray }) + } else isFirst = false } reset()