mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
LibWeb+WebWorker: Implement a first cut of post_message for Workers
This implementation completely ignores MessagePorts, and manually plumbs data through LocalSockets.
This commit is contained in:
parent
05ec93e276
commit
1602663b9e
15 changed files with 225 additions and 29 deletions
18
Tests/LibWeb/Text/input/Worker/Worker-echo.html
Normal file
18
Tests/LibWeb/Text/input/Worker/Worker-echo.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<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>
|
Loading…
Add table
Add a link
Reference in a new issue