-
Notifications
You must be signed in to change notification settings - Fork 3
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
a73a1c3
commit 09d15c5
Showing
9 changed files
with
115 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fn main() { | ||
wasm_logger::init(wasm_logger::Config::default()); | ||
log::debug!("App is starting"); | ||
// yew::Renderer::<Main>::new().render(); | ||
yew::Renderer::<axiom_profiler_gui::App>::new().render(); | ||
} |
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,6 @@ | ||
use yew_agent::PrivateWorker; | ||
use axiom_profiler_gui::results::worker::Worker; | ||
|
||
fn main() { | ||
Worker::register(); | ||
} |
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,4 +1,5 @@ | ||
pub mod svg_result; | ||
pub mod filters; | ||
pub mod graph; | ||
pub mod worker; | ||
|
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,59 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use yew_agent::{HandlerId, Private, WorkerLink}; | ||
|
||
pub struct Worker { | ||
link: WorkerLink<Self>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct WorkerInput { | ||
pub n: u32, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct WorkerOutput { | ||
pub input: u32, | ||
pub value: u32, | ||
} | ||
|
||
impl yew_agent::Worker for Worker { | ||
type Message = (); | ||
type Input = WorkerInput; | ||
type Output = WorkerOutput; | ||
type Reach = Private<Self>; | ||
|
||
fn create(link: WorkerLink<Self>) -> Self { | ||
Self { link } | ||
} | ||
|
||
fn update(&mut self, _msg: Self::Message) { | ||
// no messaging | ||
} | ||
|
||
fn handle_input(&mut self, msg: Self::Input, id: HandlerId) { | ||
// this runs in a web worker | ||
// and does not block the main | ||
// browser thread! | ||
|
||
let n = msg.n; | ||
|
||
fn fib(n: u32) -> u32 { | ||
if n <= 1 { | ||
1 | ||
} else { | ||
fib(n - 1) + fib(n - 2) | ||
} | ||
} | ||
|
||
let output = Self::Output { input: n, value: fib(n) }; | ||
self.link.respond(id, output); | ||
} | ||
|
||
fn name_of_resource() -> &'static str { | ||
"worker.js" | ||
} | ||
|
||
fn resource_path_is_relative() -> bool { | ||
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 |
---|---|---|
|
@@ -11,10 +11,14 @@ | |
flex: 1; | ||
} | ||
|
||
.node { | ||
cursor: pointer; | ||
} | ||
|
||
.node:hover { | ||
opacity: 0.6 | ||
} | ||
|
||
.edge:hover * { | ||
opacity: 0.4 | ||
} | ||
} |