This repository has been archived by the owner on Jul 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
14 changed files
with
32 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
vendor | ||
build | ||
build | ||
dev/js/**/*.amd.js |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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 |
---|---|---|
|
@@ -71,4 +71,9 @@ | |
width:100%; | ||
} | ||
} | ||
label, | ||
a { | ||
display:inline-block; | ||
vertical-align:middle; | ||
} | ||
} |
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
Binary file not shown.
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
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 |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import Observer from "./observer.js"; | ||
import app from "./app.js"; | ||
|
||
let calcWorker = new Worker("js/calc.js"); | ||
let worker = new Worker("js/calc.js"); | ||
let blockingMethod = "ready"; | ||
app.busy = true; // calc worker needs some initialization before it can be used | ||
|
||
let worker = Object.assign(new Observer(), { | ||
let workerHelper = Object.assign(new Observer(), { | ||
invoke(method, data) { | ||
if (blockingMethod) { | ||
throw new Error(`Unable to run the method “${method}” as the blocking method “${blockingMethod}” is still running`); | ||
} | ||
blockingMethod = method; | ||
app.busy = true; // note that every worker invocation turns the application into busy state | ||
calcWorker.postMessage({method, data}); | ||
worker.postMessage({method, data}); | ||
} | ||
}); | ||
|
||
calcWorker.addEventListener("message", ({data: {method, data} = {}}) => { | ||
worker.addEventListener("message", ({data: {method, data} = {}}) => { | ||
if (method) { | ||
if (method === blockingMethod) { | ||
app.busy = false; | ||
blockingMethod = null; | ||
} | ||
worker.trigger(method, data); | ||
workerHelper.trigger(method, data); | ||
} | ||
}); | ||
|
||
calcWorker.addEventListener("error", e => {throw e;}); | ||
worker.addEventListener("error", e => {throw e;}); | ||
|
||
export default worker; | ||
export default workerHelper; |
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