/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/worker/chat-worker.js
20 строк
375 B
Tobias Koppers
new Worker() support
08 сен 2020, 08:37
08 сен 2020, 08:37
ed06a7f
Код
Авторство
О чём код?
import { history, add } from "./chat-module"; onconnect = function (e) { for (const port of e.ports) { port.onmessage = event => { const msg = event.data; switch (msg.type) { case "message": add(msg.content, msg.from); // fallthrough case "history": port.postMessage({ type: "history", history }); break; } }; } };