summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/lib/broadcast/mapChannel.ts
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2024-01-08 20:22:32 +0000
committerGerrit Code Review <gerrit@onap.org>2024-01-08 20:22:32 +0000
commitbcdc27548c306574a58b47d923509abc6f616719 (patch)
treed738ec5055fde7d13d8c881233c9d7d24678d322 /sdnr/wt/odlux/lib/broadcast/mapChannel.ts
parent2466688813df1742d0b21222bcd5d3f4276f9440 (diff)
parentc5b8756512cb6dfbb0093514af7924cb3e78699b (diff)
Merge "Delete wt/odlux directory"
Diffstat (limited to 'sdnr/wt/odlux/lib/broadcast/mapChannel.ts')
-rw-r--r--sdnr/wt/odlux/lib/broadcast/mapChannel.ts29
1 files changed, 0 insertions, 29 deletions
diff --git a/sdnr/wt/odlux/lib/broadcast/mapChannel.ts b/sdnr/wt/odlux/lib/broadcast/mapChannel.ts
deleted file mode 100644
index efd76eb8c..000000000
--- a/sdnr/wt/odlux/lib/broadcast/mapChannel.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-
-const channel: BroadcastChannel = new BroadcastChannel("odlux_map");
-const listeners: { [key: string]: ((data: any) => void)[] } = {};
-
-channel.onmessage = (eventMessage: MessageEvent<any>) => {
- const { key, data } = eventMessage.data;
- if (listeners[key]) {
- listeners[key].forEach(listener => listener(data));
- }
-};
-
-export const sendMapMessage = (data: any, key: string) => {
- channel.postMessage({ key, data });
-};
-
-export const addMapMessageListener = (key: string, listener: (data: any) => void) => {
- if (!listeners[key]) {
- listeners[key] = [];
- }
-
- if (!listeners[key].find(l => l === listener)) {
- listeners[key].push(listener);
- }
-
- return () => {
- listeners[key] = listeners[key].filter(l => l !== listener);
- }
-};
-