1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-28 18:19:08 -05:00
denoland-deno/cli/tests/workers/large_message_worker.js
Inteon dccf5e0c5c
refactor(core): Allow multiple overflown responses in single poll (#9433)
This commit rewrites "JsRuntime::poll" function to fix a corner case that
might caused "overflown_response" to be overwritten by other overflown response.

The logic has been changed to allow returning multiple overflown response
alongside responses from shared queue.
2021-02-23 13:08:50 +01:00

14 lines
304 B
JavaScript

// Copyright 2020 the Deno authors. All rights reserved. MIT license.
const dataSmall = "";
const dataLarge = "x".repeat(10 * 1024);
onmessage = function (e) {
for (let i = 0; i <= 10; i++) {
if (i % 2 == 0) {
postMessage(dataLarge);
} else {
postMessage(dataSmall);
}
}
};