mirror of
https://github.com/denoland/deno.git
synced 2024-11-15 16:43:44 -05:00
635253bd3a
This commit upgrade "Worker.postMessage()" implementation to use structured clone algorithm instead of non-spec compliant JSON serialization.
14 lines
304 B
JavaScript
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);
|
|
}
|
|
}
|
|
};
|