From 7b695c87c79e5fdc4ef1b1b6871ea7bef44b9f40 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:34:34 +0700 Subject: [PATCH] array --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a06ef48..9988598 100644 --- a/index.js +++ b/index.js @@ -25,10 +25,12 @@ io.on('connection', (socket) => { } } - socket.on('setFunctions', (...args) => { + socket.on('setFunctions', (jsonArray) => { + const parsed = JSON.parse(jsonArray) + functions = {} - for (const eachFuntion of args) { + for (const eachFuntion of parsed) { functions[eachFuntion] = (...args) => socket.emit(BRIDGE_PREFIX + eachFuntion, ...args) }