MCPcopy
hub / github.com/jabbany/CommentCoreLibrary / dispatchMessage

Function dispatchMessage

src/scripting/OOAPI.js:10–27  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

8 var channels = {};
9
10 function dispatchMessage (msg) {
11 if (channels.hasOwnProperty(msg.channel)) {
12 for(var i = 0; i < channels[msg.channel].listeners.length; i++) {
13 try {
14 channels[msg.channel].listeners[i](msg.payload);
15 } catch(e) {
16 if (e.stack) {
17 __trace(e.stack.toString(), 'err');
18 } else {
19 __trace(e.toString(), 'err');
20 }
21 }
22 }
23 } else {
24 __trace('Got message on channel "' + msg.channel +
25 '" but channel does not exist.', 'warn');
26 }
27 };
28
29 self.addEventListener('message', function (event) {
30 if (!event) {

Callers 1

OOAPI.jsFile · 0.70

Calls 3

__traceFunction · 0.85
hasOwnPropertyMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected