From 48ceded78f85fef1de4841f7d8c271c30b14a782 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 24 Nov 2022 01:46:55 -0500 Subject: [PATCH] *Add item-added and item-removed events --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index a3b65bb..d11c25e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -236,11 +236,13 @@ export default class DHTCache extends EventEmitter { if (Type.ADD_ITEM === type) { this._ensureItem(bufData); this._addEntityConnection(id, bufData); + this.emit("item-added", id, bufData); } if (Type.REMOVE_ITEM === type) { this.removeItem(bufData); this._pruneItems(); + this.emit("item-removed", id, bufData); } } } else if (type === Type.CONNECTED) {