Skip to content

Instantly share code, notes, and snippets.

View jakobrosenberg's full-sized avatar

Jakob Rosenberg jakobrosenberg

View GitHub Profile
@timdp
timdp / create-worker.js
Created April 4, 2021 21:48
AVA Shared Worker utils
const createDebug = require('debug')
const { serializeError } = require('serialize-error')
const receiveCommands = async (main, commands, debug) => {
for await (const message of main.subscribe()) {
if (message.data == null || typeof message.data.type !== 'string') {
debug('unexpected message', { message })
continue
}
const { type, payload } = message.data