1 2 3 4 5 6 7 8 9 10 11 12 13
"use strict"; self.addEventListener("message", function onMessage(event) { const { type, message } = event.data; switch (type) { case "log": console.log(message); break; case "error": throw new Error(message); } });