MCPcopy Create free account
hub / github.com/MultithreadedJSBook/code-samples / asyncOnMessageWrap

Function asyncOnMessageWrap

ch8-template-render/worker.js:4–8  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

2const template = require('./template.js');
3
4function asyncOnMessageWrap(fn) {
5 return async function(msg) {
6 parentPort.postMessage(await fn(msg));
7 }
8}
9
10const commands = {
11 renderLove: (data) => template.renderLove(data)

Callers 1

worker.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected