Skip to content

Commit f39d1ba

Browse files
authored
fix: add config param to wasm init function (#59)
1 parent 70cab45 commit f39d1ba

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

crates/processing_render/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,15 @@ pub fn init(config: Config) -> error::Result<()> {
293293

294294
/// Initialize the app asynchronously
295295
#[cfg(target_arch = "wasm32")]
296-
pub async fn init() -> error::Result<()> {
296+
pub async fn init(config: Config) -> error::Result<()> {
297297
use bevy::app::PluginsState;
298298

299299
setup_tracing()?;
300300
if is_already_init()? {
301301
return Ok(());
302302
}
303303

304-
let mut app = create_app();
304+
let mut app = create_app(config);
305305

306306
// we need to avoid blocking the main thread while waiting for plugins to initialize
307307
while app.plugins_state() == PluginsState::Adding {

crates/processing_wasm/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
use bevy::prelude::Entity;
44
use processing_render::{
5-
exit, graphics_begin_draw, graphics_end_draw, graphics_flush, graphics_record_command,
6-
image_create, image_destroy, image_load, image_readback, image_resize, init,
7-
render::command::DrawCommand, surface_create_from_canvas, surface_destroy, surface_resize,
5+
config::Config, exit, graphics_begin_draw, graphics_end_draw, graphics_flush,
6+
graphics_record_command, image_create, image_destroy, image_load, image_readback, image_resize,
7+
init, render::command::DrawCommand, surface_create_from_canvas, surface_destroy,
8+
surface_resize,
89
};
910
use wasm_bindgen::prelude::*;
1011

@@ -19,7 +20,8 @@ fn wasm_start() {
1920

2021
#[wasm_bindgen(js_name = "init")]
2122
pub async fn js_init() -> Result<(), JsValue> {
22-
check(init().await)
23+
let config = Config::new();
24+
check(init(config).await)
2325
}
2426

2527
#[wasm_bindgen(js_name = "createSurface")]

0 commit comments

Comments
 (0)