MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / wrapMsgHandler

Function wrapMsgHandler

src/wasm_worker.js:51–58  ·  view source on GitHub ↗
(h)

Source from the content-addressed store, hash-verified

49 /** @suppress {checkTypes} */
50 globalThis.onmessage = null;
51 function wrapMsgHandler(h) {
52 var f = wrappedHandlers.get(h)
53 if (!f) {
54 f = (msg) => h({data: msg});
55 wrappedHandlers.set(h, f);
56 }
57 return f;
58 }
59
60 Object.assign(globalThis, {
61 addEventListener: (name, handler) => parentPort['on'](name, wrapMsgHandler(handler)),

Callers 1

#elseFunction · 0.85

Calls 3

getMethod · 0.65
setMethod · 0.65
hFunction · 0.50

Tested by

no test coverage detected