generated from My-Templates/TypeScript-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipc-worker.js
31 lines (30 loc) · 1022 Bytes
/
ipc-worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
(function (self) {
var ports = new Set();
self.onconnect = function (e) {
if ((e === null || e === void 0 ? void 0 : e.source) && e.source instanceof MessagePort) {
var port_1 = e.source;
ports.add(port_1);
port_1.addEventListener('message', function (ev) {
var data = ev.data;
var cmd = data === null || data === void 0 ? void 0 : data.cmd;
switch (cmd) {
case 'x':
ports.delete(port_1);
break;
default:
ports.forEach(function (p) {
if (p !== port_1) {
p.postMessage(data);
}
});
}
}, false);
port_1.start();
}
};
self.onerror = function (e) {
console.error(e);
};
})(self);
//# sourceMappingURL=ipc-worker.js.map