blog/lib/watch-worker.ts

18 lines
531 B
TypeScript

import { articles } from "./tasks/articles.ts";
import { css } from "./tasks/css.ts";
import { fonts } from "./tasks/fonts.ts";
import { images } from "./tasks/images.ts";
import { svg } from "./tasks/svg.ts";
const TASKS: { [task: string]: () => Promise<void> } = { articles, css, fonts, images, svg };
self.addEventListener("message", async (message) => {
const { task } = message.data;
console.log("[start]", task);
await TASKS[task]();
console.log("[done]", task);
self.postMessage({ done: true });
});