-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
C-FeatureMake something new possibleMake something new possible
Description
What problem does this solve or what need does it fill?
I want to turn a bevy app canvas into an npm package and use it as a typed React component, e.g.
npm install @nuzzles/my-game@ae3b1d31d699e62249cead029b0e10f37a9ed9acUsage:
import { useBevyApp } from '@nuzzles/my-game@ae3b1d31d699e62249cead029b0e10f37a9ed9ac';
const [wasmHandle, wasmBindings, loading, error] = useBevyApp();
# Examples:
# - Do something on load finish (callback)
# - Use multiple game canvases on a single page
# - Use any binding output via wasm_bindgen
What solution would you like?
I would like to build a complete npm package that includes lexically-scoped typed bindings and handling of the bevy app load. This way, updating my game is as simple as updating my npm package.
There are a few problems that make this very complex:
- Generating good typed
.tsbindings for an npm package - wasm-bindgen outputs bindings that use global data by default, which means
const app = app.init();works, but initializing a second app would overwrite state from the first initialization. See Instance-Scoped Runtime (No Global State) wasm-bindgen/wasm-bindgen#4888
What alternative(s) have you considered?
There really is none.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-FeatureMake something new possibleMake something new possible