-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detach worker registration from a main initialization routine
Workers become more compact with simple type specification.
- Loading branch information
1 parent
8339292
commit 07c6aec
Showing
8 changed files
with
308 additions
and
233 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
### multi_thread | ||
|
||
You should compile a worker which have to be spawned in a separate thread: | ||
|
||
```sh | ||
cargo web build --bin native_worker --target wasm32-unknown-unknown | ||
``` |
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,14 @@ | ||
|
||
extern crate web_logger; | ||
extern crate yew; | ||
extern crate multi_thread; | ||
|
||
use yew::prelude::*; | ||
use multi_thread::native_worker; | ||
|
||
fn main() { | ||
web_logger::init(); | ||
yew::initialize(); | ||
native_worker::Worker::register(); | ||
yew::run_loop(); | ||
} |
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 |
---|---|---|
|
@@ -65,4 +65,6 @@ impl Agent for Worker { | |
} | ||
} | ||
} | ||
|
||
fn name_of_resource() -> &'static str { "bin/native_worker.js" } | ||
} |
Oops, something went wrong.