@ipcom/asterisk-ari 0.0.125 → 0.0.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.cjs
CHANGED
|
@@ -1919,13 +1919,13 @@ var WebSocketClient = class extends import_events3.EventEmitter {
|
|
|
1919
1919
|
*/
|
|
1920
1920
|
addScopedMessageListener(instanceId, app, callback) {
|
|
1921
1921
|
const key = `${app}:${instanceId}`;
|
|
1922
|
-
if (key.includes("removeListener")) {
|
|
1923
|
-
console.warn(`Evento interno ignorado: '${key}'.`);
|
|
1924
|
-
return;
|
|
1925
|
-
}
|
|
1926
1922
|
if (this.scopedListeners.has(key)) {
|
|
1927
|
-
console.warn(
|
|
1928
|
-
|
|
1923
|
+
console.warn(
|
|
1924
|
+
`Listener escopado j\xE1 existe para '${key}'. Removendo antigo.`
|
|
1925
|
+
);
|
|
1926
|
+
const existingListener = this.scopedListeners.get(key);
|
|
1927
|
+
this.off("message", existingListener);
|
|
1928
|
+
this.scopedListeners.delete(key);
|
|
1929
1929
|
}
|
|
1930
1930
|
const scopedListener = (data) => {
|
|
1931
1931
|
if (data.application === app && (data.type.startsWith("Channel") && "channel" in data && data.channel?.id === instanceId || data.type.startsWith("Playback") && "playbackId" in data && data.playbackId === instanceId)) {
|
|
@@ -1953,29 +1953,14 @@ var WebSocketClient = class extends import_events3.EventEmitter {
|
|
|
1953
1953
|
console.warn(`Nenhum listener encontrado para a inst\xE2ncia '${key}'.`);
|
|
1954
1954
|
return;
|
|
1955
1955
|
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
this.off("message", scopedListener);
|
|
1959
|
-
console.log(`Listener removido com sucesso para '${key}'.`);
|
|
1960
|
-
} else {
|
|
1961
|
-
console.warn(`Listener j\xE1 foi removido ou n\xE3o encontrado para '${key}'.`);
|
|
1962
|
-
}
|
|
1956
|
+
console.log(`Removendo listener escopado para '${key}'.`);
|
|
1957
|
+
this.off("message", scopedListener);
|
|
1963
1958
|
this.scopedListeners.delete(key);
|
|
1964
1959
|
console.log(
|
|
1965
|
-
`Listeners escopados removidos para
|
|
1960
|
+
`Listeners escopados removidos para '${key}'. Total de listeners restantes: ${this.listenerCount(
|
|
1966
1961
|
"message"
|
|
1967
1962
|
)}`
|
|
1968
1963
|
);
|
|
1969
|
-
const removeKey = `${key}:removeListener`;
|
|
1970
|
-
const removeListener = this.scopedListeners.get(removeKey);
|
|
1971
|
-
if (removeListener) {
|
|
1972
|
-
this.off("message", removeListener);
|
|
1973
|
-
this.scopedListeners.delete(removeKey);
|
|
1974
|
-
console.log(
|
|
1975
|
-
`Listener de 'removeListener' tamb\xE9m foi removido para '${key}'.`
|
|
1976
|
-
);
|
|
1977
|
-
}
|
|
1978
|
-
console.log("Depois de remover listeners:");
|
|
1979
1964
|
this.listListeners("message");
|
|
1980
1965
|
}
|
|
1981
1966
|
/**
|