From efa7231f586fc11c057d4e12d7ff11acdd8b9d0e Mon Sep 17 00:00:00 2001 From: kenny <397317382@qq.com> Date: Tue, 26 Dec 2023 20:07:51 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/internal/teleport.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3498f38..dfc34da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mwx47/teleport", - "version": "1.2.0", + "version": "1.2.1", "description": "A library for managing and communicating events in your application through a singleton pattern. This pattern ensures that there is a single instance of the event manager, making it easy to coordinate and handle events across different parts of your codebase.", "main": "./src/index.js", "keywords": [ diff --git a/src/internal/teleport.ts b/src/internal/teleport.ts index 33adcc6..9e71f29 100644 --- a/src/internal/teleport.ts +++ b/src/internal/teleport.ts @@ -331,14 +331,14 @@ export class TeleportSingleton { this._multiEventsList.push(nameList); const clearChildrenHandlers = nameList.map((eventName) => { + // TODO: 收集receive到的数据,储存到一个map里面,如果clear,就同时也clear掉里面的数据。 return this.receive(eventName, () => { }); }); // clear child handlers and father handler - const _this = this; const clearAll = (names:string[], clearHandler:{clear: () => void}) => { return { clear: () => { - _this._removeMultiEvent(names); + this._removeMultiEvent(names); clearHandler.clear(); clearChildrenHandlers.forEach((childHandler) => { childHandler.clear() }); }}