summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/workers/worker_large_message.js
blob: a1ddae4f981ddaaa8960d67d81f482cfedd81c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// 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);
    }
  }
};