Skip to content

Conversation

RReverser
Copy link
Member

@RReverser RReverser commented Feb 26, 2021

As the name implies, it's already optional, but wasn't marked as such in TS.

We could put some more complicated / stricter types here depending on type of the first argument, but at least this fixes the issue for TS consumers.

Also fixes an issue where maybe_memory wouldn't be initialised if the input (module) is given as an ArrayBuffer.

Fixes #2133

As the name implies, it's already optional, but wasn't marked as such in TS.

We could put some more complicated / stricter types here depending on type of the first argument, but at least this fixes the issue for TS consumers.

Fixes wasm-bindgen#2133
@RReverser
Copy link
Member Author

Just noticed the issue with passing in ArrayBuffer too; please don't merge yet, fixing it as well.

It should always be built with nightly, and this file sets the toolchain for Rustup.
 - Unify `init_memory` for `maybe_memory` case to use either the explicitly given value or the default (`new WebAssembly.Memory(...)`).
 - Move it to the main `init` function where all other `imports` are assigned too.
 - Remove global `memory` variable which doesn't seem to be used by anything.
@RReverser
Copy link
Member Author

Done. /cc @alexcrichton @Pauan

@RReverser RReverser changed the title Make maybe_memory optional in TS Make maybe_memory truly optional Feb 26, 2021
Copy link
Contributor

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me, thanks!

@alexcrichton alexcrichton merged commit 7f99f03 into wasm-bindgen:master Mar 4, 2021
@RReverser RReverser deleted the maybe-memory branch March 4, 2021 18:28
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.

Parameter maybe_memory should be optional

2 participants