1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-31 09:32:43 +00:00
serenity/Tests/LibWeb/Text/input/Worker/Worker-echo.html
Andrew Kaster 1602663b9e LibWeb+WebWorker: Implement a first cut of post_message for Workers
This implementation completely ignores MessagePorts, and manually plumbs
data through LocalSockets.
2023-11-24 08:41:38 +01:00

18 lines
526 B
HTML

<script src="../include.js"></script>
<script>
asyncTest((done) => {
let work = new Worker("worker.js");
let count = 0;
work.onmessage = (evt) => {
println("Got message from worker: " + JSON.stringify(evt.data));
count++;
work.postMessage({"msg": "marco"});
if (count === 2) {
println("DONE");
work.onmessage = null;
work.terminate();
done();
}
};
});
</script>