Skip to content

Fix wasm-bindgen initialization function warning#35

Open
Destructor17 wants to merge 1 commit intochemicstry:mainfrom
webrogue-runtime:bindgen-entrypoint-warning
Open

Fix wasm-bindgen initialization function warning#35
Destructor17 wants to merge 1 commit intochemicstry:mainfrom
webrogue-runtime:bindgen-entrypoint-warning

Conversation

@Destructor17
Copy link
Copy Markdown

@Destructor17 Destructor17 commented Apr 1, 2026

I've had to fork wasm_thread to add some specific features like async entrypoint and post_message. I hope to upstream these changes later, but first things first.

JS shim initialization function generated by new versions of wasm-bindgen now looks like this:

async function __wbg_init(module_or_path, memory) {
    ...
    if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
        ({module_or_path, memory, thread_stack_size} = module_or_path)
    } else {
        console.warn('using deprecated parameters for the initialization function; pass a single object instead')
    }
    ...

It excepts both module and memory to be passed using one object (see diff), otherwise logs a warning.

This PR also contains some changes my IDE did without asking me, but I guess it's for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant