mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 18:20:51 +00:00
Merge pull request #1235 from fitzgen/some-little-things
A couple small improvements
This commit is contained in:
commit
311dafd366
@ -612,7 +612,17 @@ impl<'a> Context<'a> {
|
||||
memory = __exports.memory = {init_memory};
|
||||
const response = fetch(module_or_path);
|
||||
if (typeof WebAssembly.instantiateStreaming === 'function') {{
|
||||
result = WebAssembly.instantiateStreaming(response, imports);
|
||||
result = WebAssembly.instantiateStreaming(response, imports)
|
||||
.catch(e => {{
|
||||
console.warn(\"`WebAssembly.instantiateStreaming` failed. Assuming this is \
|
||||
because your server does not serve wasm with \
|
||||
`application/wasm` MIME type. Falling back to \
|
||||
`WebAssembly.instantiate` which is slower. Original \
|
||||
error:\\n\", e);
|
||||
return response
|
||||
.then(r => r.arrayBuffer())
|
||||
.then(bytes => WebAssembly.instantiate(bytes, imports));
|
||||
}});
|
||||
}} else {{
|
||||
result = response
|
||||
.then(r => r.arrayBuffer())
|
||||
|
@ -4339,7 +4339,7 @@ impl From<String> for JsString {
|
||||
|
||||
impl<'a> From<&'a JsString> for String {
|
||||
fn from(s: &'a JsString) -> Self {
|
||||
s.obj.as_string().unwrap()
|
||||
s.obj.as_string().unwrap_throw()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user