summaryrefslogtreecommitdiffstats
path: root/devtools/shared/webconsole/test/chrome/console-test-worker.js
blob: 9e92f6af6589a602e76adab8ef4413afe054c3ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"use strict";

console.log("Log from worker init");

function f() {
  const a = 1;
  const b = 2;
  const c = 3;
  return { a, b, c };
}

self.onmessage = function (event) {
  if (event.data == "ping") {
    f();
    postMessage("pong");
  } else if (event.data?.type == "log") {
    console.log(event.data.message);
  }
};

postMessage("load");