workerizing
This commit is contained in:
parent
0006f6483d
commit
19f2434694
2 changed files with 124 additions and 13 deletions
|
|
@ -37,6 +37,14 @@ export function repl({
|
|||
worker.onmessage = ({ data: { answer } }) => {
|
||||
console.log(answer);
|
||||
};
|
||||
|
||||
const sharedworker = new SharedWorker(new URL('./cyclistworker.js', import.meta.url));
|
||||
|
||||
sharedworker.port.start();
|
||||
sharedworker.port.addEventListener('message', (message) => {
|
||||
console.log(message);
|
||||
});
|
||||
|
||||
const updateState = (update) => {
|
||||
Object.assign(state, update);
|
||||
state.isDirty = state.code !== state.activeCode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue