From 32f1c753d08858372b70f721a6fd94fa1a229dcf Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Mon, 15 Jun 2020 12:52:18 +0800 Subject: [PATCH] =?UTF-8?q?[unisocket.js]=20=E6=B7=BB=E5=8A=A0=20countList?= =?UTF-8?q?ener=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unisocket/unisocket.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unisocket/unisocket.js b/unisocket/unisocket.js index e6b4eb9..94b86dd 100644 --- a/unisocket/unisocket.js +++ b/unisocket/unisocket.js @@ -66,6 +66,12 @@ module.exports={ } return this }, + countListener(skevent){ + if (Array.isArray(my.listeners[skevent])) { + return my.listeners[skevent].length + } + return 0 + }, sendObject(dataObj){ if (my.socket && my.socket.readyState===my.socket.OPEN){ my.socket.send({