This repository has been archived by the owner on Sep 9, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c117a7c
commit 1e761ed
Showing
7 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Worker from './worker.js'; | ||
|
||
const worker = new Worker(); | ||
|
||
let result; | ||
|
||
worker.onmessage = function (event) { | ||
if (!result) { | ||
result = document.createElement("div"); | ||
result.setAttribute('id', 'result'); | ||
|
||
document.body.append(result); | ||
} | ||
|
||
result.innerText = JSON.stringify(event.data) | ||
}; | ||
|
||
const button = document.getElementById('button'); | ||
|
||
button.addEventListener('click', () => { | ||
worker.postMessage({ postMessage: true }) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Webpack App</title> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
</head> | ||
<body> | ||
|
||
<button id="button">Run Action</button> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import foo from 'my-custom-module'; | ||
|
||
onmessage = function(event) { | ||
const workerResult = event.data; | ||
|
||
workerResult.onmessage = true; | ||
|
||
postMessage(workerResult); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters