/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/testdata/workers/message_burst.ts
13 строк
540 B
em
perf(workers): incremental message-passing cleanups (#35108)
24 июн 2026, 09:42
Не верифицирован
24 июн 2026, 09:42
70ac96e
Код
Авторство
О чём код?
// Copyright 2018-2026 the Deno authors. MIT license. // On receiving a count, synchronously posts that many messages back to the // host in one event-loop turn. This exercises the host-side (Web `Worker` // main-thread) bounded sync-drain receive loop: the messages all land in the // channel as a burst, so the main thread receives the first asynchronously and // drains the rest synchronously. self.onmessage = (e: MessageEvent) => { const count = e.data as number; for (let i = 0; i < count; i++) { self.postMessage(i); } };