mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
1602663b9e
This implementation completely ignores MessagePorts, and manually plumbs data through LocalSockets.
33 lines
1 KiB
HTML
33 lines
1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Worker</title>
|
|
</head>
|
|
<body>
|
|
<h2>Worker Test</h2>
|
|
<div id="output"></div>
|
|
<script type="text/javascript">
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
console.log("Page Loaded. Sending message");
|
|
console.log("Parent Keys: ", JSON.stringify(Object.keys(this)));
|
|
|
|
var work = new Worker("worker.js");
|
|
work.onmessage = (evt) => {
|
|
console.log("Got message from worker:", evt.data);
|
|
};
|
|
|
|
document
|
|
.getElementById("btn_hello")
|
|
.addEventListener("click", function() {
|
|
console.log("Sending Message");
|
|
work.postMessage({ "msg": "Hey buddy!" });
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<button id="btn_hello">
|
|
Say Hello!
|
|
</button>
|
|
</body>
|
|
</html>
|