From b22383dffc98fc0805b6da6eb448f34f756bd3a1 Mon Sep 17 00:00:00 2001 From: parag-pv Date: Mon, 5 Aug 2024 10:41:30 -0400 Subject: [PATCH] Initial commit. Removing listener from promise list --- languages/javascript/src/shared/Events/index.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/languages/javascript/src/shared/Events/index.mjs b/languages/javascript/src/shared/Events/index.mjs index 18c2092a..f4aa70f6 100644 --- a/languages/javascript/src/shared/Events/index.mjs +++ b/languages/javascript/src/shared/Events/index.mjs @@ -177,6 +177,9 @@ const doListen = function(module, event, callback, context, once, internal=false resolve(listenerId) } else { + // Remove the listerner from Promise list on failure to register + const key = module + '.' + event + (hasContext ? `.${contextKey}` : '') + delete listeners.external[key][listenerId] reject(error) } }) @@ -184,7 +187,6 @@ const doListen = function(module, event, callback, context, once, internal=false else { resolve(listenerId) } - return p } }