From f063cf4a16aba7b801f5132bf501f84f50f6ad5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 26 Aug 2024 00:50:17 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/framework/event.ts | 1 + src/common/utils/MessageUnique.ts | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/common/framework/event.ts b/src/common/framework/event.ts index 567b63fe..dc2d0bce 100644 --- a/src/common/framework/event.ts +++ b/src/common/framework/event.ts @@ -6,6 +6,7 @@ export type ListenerClassBase = Record; export interface ListenerIBase { // eslint-disable-next-line @typescript-eslint/no-misused-new new(listener: any): ListenerClassBase; + [key: string]: any; } export class NTEventChannel extends EventEmitter { diff --git a/src/common/utils/MessageUnique.ts b/src/common/utils/MessageUnique.ts index 725c51de..6a33c054 100644 --- a/src/common/utils/MessageUnique.ts +++ b/src/common/utils/MessageUnique.ts @@ -15,23 +15,13 @@ export class LimitedHashTable { } set(key: K, value: V): void { - // const isExist = this.keyToValue.get(key); - // if (isExist && isExist === value) { - // return; - // } this.keyToValue.set(key, value); this.valueToKey.set(value, key); while (this.keyToValue.size !== this.valueToKey.size) { - //console.log('keyToValue.size !== valueToKey.size Error Atom'); this.keyToValue.clear(); this.valueToKey.clear(); } - // console.log('---------------'); - // console.log(this.keyToValue); - // console.log(this.valueToKey); - // console.log('---------------'); while (this.keyToValue.size > this.maxSize || this.valueToKey.size > this.maxSize) { - //console.log(this.keyToValue.size > this.maxSize, this.valueToKey.size > this.maxSize); const oldestKey = this.keyToValue.keys().next().value; this.valueToKey.delete(this.keyToValue.get(oldestKey)!); this.keyToValue.delete(oldestKey); @@ -108,10 +98,6 @@ class MessageUniqueWrapper { hash[0] &= 0x7f; const shortId = hash.readInt32BE(0); //减少性能损耗 - // const isExist = this.msgIdMap.getKey(shortId); - // if (isExist && isExist === msgId) { - // return shortId; - // } this.msgIdMap.set(msgId, shortId); this.msgDataMap.set(key, shortId); return shortId;