diff --git a/index.js b/index.js index 4fb5edd..c7bdf14 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,8 @@ io.on('connection', (socket) => { let isFirst = true + let jsonArray + function reset () { worker = new Worker(path.join(__dirname, 'vm.js')) @@ -36,7 +38,9 @@ io.on('connection', (socket) => { reset() - socket.on('setFunctions', (jsonArray) => { + socket.on('setFunctions', (_jsonArray) => { + jsonArray = _jsonArray + worker.postMessage({ type: 'setFunctions', jsonArray }) })