Skip to main content

Crate plushie_renderer_wasm

Crate plushie_renderer_wasm 

Source
Expand description

WASM entry point for the plushie renderer.

Provides a wasm-bindgen API for running plushie in the browser. Uses iced::daemon with a canvas-based backend and communicates with the host via JavaScript callbacks.

§Usage from JavaScript

import init, { PlushieApp } from './plushie_renderer_wasm.js';

await init();
const app = new PlushieApp(settingsJson, (event) => {
    console.log('event:', event);
});
app.send_message(snapshotJson);

§Usage from Rust (custom WASM builds with widgets)

let mut builder = plushie_widget_sdk::app::PlushieAppBuilder::new();
builder.register(Box::new(MyWidget));
let app = PlushieApp::with_widgets(settings, on_event, builder)?;
app.send_message(snapshot_json)?;

§Limitations

  • Platform effects (file dialogs, clipboard, notifications) are stubbed as unsupported. Web API implementations can be added in a future iteration.
  • The WASM entry point assumes standard single-threaded wasm32-unknown-unknown. Shared-memory wasm modules are rejected at runtime because the JavaScript callback output path is not thread-safe.

Structs§

PlushieApp
WASM plushie renderer handle.