fix hot reload after wasm conditional compilation
This commit is contained in:
parent
6dea19e55b
commit
fb86131917
1 changed files with 5 additions and 5 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -24,7 +24,7 @@ async fn main() {
|
|||
}
|
||||
rand::srand(macroquad::miniquad::date::now() as _);
|
||||
|
||||
let reader = hotwatch();
|
||||
let (_hot, reader) = hotwatch();
|
||||
|
||||
match read_file() {
|
||||
Err(err) => println!("Error: {err:#?}"),
|
||||
|
|
@ -70,7 +70,7 @@ fn read_file() -> std::io::Result<String> {
|
|||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn hotwatch() -> Arc<RwLock<Option<ayin::ast::Program>>> {
|
||||
fn hotwatch() -> (hotwatch::Hotwatch, Arc<RwLock<Option<ayin::ast::Program>>>) {
|
||||
let writer = Arc::new(RwLock::new(None));
|
||||
let reader = writer.clone();
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
|
|
@ -93,11 +93,11 @@ fn hotwatch() -> Arc<RwLock<Option<ayin::ast::Program>>> {
|
|||
}
|
||||
})
|
||||
.expect("failed to watch file!");
|
||||
reader
|
||||
(hotwatch, reader)
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn hotwatch() -> Arc<RwLock<Option<ayin::ast::Program>>> {
|
||||
fn hotwatch() -> ((), Arc<RwLock<Option<ayin::ast::Program>>>) {
|
||||
let writer = Arc::new(RwLock::new(None));
|
||||
let reader = writer.clone();
|
||||
reader
|
||||
((), reader)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue