참고소스 수정본

This commit is contained in:
LASTA_DEV01\lasta
2026-05-12 19:40:31 +09:00
parent 0f34a451fc
commit 2e9204243d
8708 changed files with 3259488 additions and 869 deletions

View File

@@ -0,0 +1 @@
console.log("hello from import-me.js");

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Remote importScripts Test</title>
</head>
<html>
<div id="status">-</div>
<script>
new Worker('worker-http-import.js').addEventListener("message", ({ data }) => {
document.getElementById("status").innerText = data;
});
</script>
</html>
</html>

View File

@@ -0,0 +1,4 @@
console.log("hello from worker-http-import.js");
importScripts("./import-me.js")
console.log("successfully imported");
self.postMessage("finished");

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Worker test</title>
</head>
<body>
<script>
var worker = new Worker('worker.js');
worker.onmessage = function(message) {
console.log(message.data);
};
</script>
</body>
</html>

View File

@@ -0,0 +1,16 @@
console.log('hello from the worker');
function workerFunction() {
return 'worker function result';
}
self.addEventListener('message', event => {
console.log('got this data: ' + event.data);
});
(async function() {
while (true) {
self.postMessage(workerFunction.toString());
await new Promise(x => setTimeout(x, 100));
}
})();