mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-16 06:21:22 +00:00
Add support for constructing JsValue instances generically
This commit is contained in:
committed by
Alex Crichton
parent
e6a483f906
commit
73619b5d15
@ -266,6 +266,11 @@ impl<'a> Context<'a> {
|
||||
}}
|
||||
"));
|
||||
ts_dst.push_str("constructor(ptr: number, sym: Symbol);\n");
|
||||
|
||||
self.globals.push_str(&format!("
|
||||
export function {new_name}(ptr) {{
|
||||
return addHeapObject(new {class}(ptr, token));
|
||||
}}", new_name=shared::new_function(&class), class=class));
|
||||
} else {
|
||||
dst.push_str(&format!("
|
||||
constructor(ptr) {{
|
||||
@ -273,6 +278,11 @@ impl<'a> Context<'a> {
|
||||
}}
|
||||
"));
|
||||
ts_dst.push_str("constructor(ptr: number);\n");
|
||||
|
||||
self.globals.push_str(&format!("
|
||||
export function {new_name}(ptr) {{
|
||||
return addHeapObject(new {class}(ptr));
|
||||
}}", new_name=shared::new_function(&class), class=class));
|
||||
}
|
||||
|
||||
dst.push_str(&format!("
|
||||
|
Reference in New Issue
Block a user