mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-18 11:22:14 +00:00
reduce the js file generated code
remove node test for browser test update usages revert test-support changes
This commit is contained in:
parent
40e1ee4484
commit
6d5afbb3d2
@ -568,7 +568,7 @@ impl<'a> Context<'a> {
|
|||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
function passStringToWasm(arg) {{
|
function passStringToWasm(arg) {{
|
||||||
{}
|
{}
|
||||||
const buf = textEncoder().encode(arg);
|
const buf = cachedEncoder.encode(arg);
|
||||||
const ptr = wasm.__wbindgen_malloc(buf.length);
|
const ptr = wasm.__wbindgen_malloc(buf.length);
|
||||||
getUint8Memory().set(buf, ptr);
|
getUint8Memory().set(buf, ptr);
|
||||||
return [ptr, buf.length];
|
return [ptr, buf.length];
|
||||||
@ -665,13 +665,7 @@ impl<'a> Context<'a> {
|
|||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
let cachedEncoder = null;
|
let cachedEncoder = new TextEncoder('utf-8');
|
||||||
function textEncoder() {{
|
|
||||||
if (cachedEncoder)
|
|
||||||
return cachedEncoder;
|
|
||||||
cachedEncoder = new TextEncoder('utf-8');
|
|
||||||
return cachedEncoder;
|
|
||||||
}}
|
|
||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,13 +685,7 @@ impl<'a> Context<'a> {
|
|||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
let cachedDecoder = null;
|
let cachedDecoder = new TextDecoder('utf-8');
|
||||||
function textDecoder() {{
|
|
||||||
if (cachedDecoder)
|
|
||||||
return cachedDecoder;
|
|
||||||
cachedDecoder = new TextDecoder('utf-8');
|
|
||||||
return cachedDecoder;
|
|
||||||
}}
|
|
||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,7 +697,7 @@ impl<'a> Context<'a> {
|
|||||||
self.expose_uint8_memory();
|
self.expose_uint8_memory();
|
||||||
self.globals.push_str(&format!("
|
self.globals.push_str(&format!("
|
||||||
function getStringFromWasm(ptr, len) {{
|
function getStringFromWasm(ptr, len) {{
|
||||||
return textDecoder().decode(getUint8Memory().slice(ptr, ptr + len));
|
return cachedDecoder.decode(getUint8Memory().slice(ptr, ptr + len));
|
||||||
}}
|
}}
|
||||||
"));
|
"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user