mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:07:36 +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
|
@ -1,10 +1,10 @@
|
|||
onmessage = evt => {
|
||||
console.log("In Worker - Got message:", JSON.stringify(evt.data));
|
||||
|
||||
postMessage(JSON.stringify(evt.data));
|
||||
postMessage(evt.data, null);
|
||||
};
|
||||
|
||||
console.log("In Worker - Loaded", this);
|
||||
console.log("Keys: ", JSON.stringify(Object.keys(this)));
|
||||
|
||||
postMessage("loaded");
|
||||
postMessage("loaded", null);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
.getElementById("btn_hello")
|
||||
.addEventListener("click", function() {
|
||||
console.log("Sending Message");
|
||||
work.postMessage("Hey buddy!");
|
||||
work.postMessage({ "msg": "Hey buddy!" });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue