-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/syncing-range
- Loading branch information
Showing
18 changed files
with
1,244 additions
and
228 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,29 @@ | ||
// this file will be installed by wasm-pack in pkg/snippets/<pkg-name>-<hash>/js/ | ||
import init, { run_worker } from '../../../lumina_node_wasm.js'; | ||
|
||
// get the path to this file | ||
export function worker_script_url() { | ||
return import.meta.url; | ||
} | ||
|
||
// if we are in a worker | ||
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { | ||
Error.stackTraceLimit = 99; | ||
|
||
// for SharedWorker we queue incoming connections | ||
// for dedicated Worker we queue incoming messages (coming from the single client) | ||
let queued = []; | ||
if (typeof SharedWorkerGlobalScope !== 'undefined' && self instanceof SharedWorkerGlobalScope) { | ||
onconnect = (event) => { | ||
queued.push(event) | ||
} | ||
} else { | ||
onmessage = (event) => { | ||
queued.push(event); | ||
} | ||
} | ||
|
||
await init(); | ||
console.log("starting worker, queued messages: ", queued.length); | ||
await run_worker(queued); | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
pub mod error; | ||
pub mod node; | ||
pub mod utils; | ||
mod worker; | ||
mod wrapper; |
Oops, something went wrong.