Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/processing_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ pub fn init(config: Config) -> error::Result<()> {

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

setup_tracing()?;
if is_already_init()? {
return Ok(());
}

let mut app = create_app();
let mut app = create_app(config);

// we need to avoid blocking the main thread while waiting for plugins to initialize
while app.plugins_state() == PluginsState::Adding {
Expand Down
10 changes: 6 additions & 4 deletions crates/processing_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

use bevy::prelude::Entity;
use processing_render::{
exit, graphics_begin_draw, graphics_end_draw, graphics_flush, graphics_record_command,
image_create, image_destroy, image_load, image_readback, image_resize, init,
render::command::DrawCommand, surface_create_from_canvas, surface_destroy, surface_resize,
config::Config, exit, graphics_begin_draw, graphics_end_draw, graphics_flush,
graphics_record_command, image_create, image_destroy, image_load, image_readback, image_resize,
init, render::command::DrawCommand, surface_create_from_canvas, surface_destroy,
surface_resize,
};
use wasm_bindgen::prelude::*;

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

#[wasm_bindgen(js_name = "init")]
pub async fn js_init() -> Result<(), JsValue> {
check(init().await)
let config = Config::new();
check(init(config).await)
}

#[wasm_bindgen(js_name = "createSurface")]
Expand Down