mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-26 22:32:12 +00:00
This commit implements the `JsCast` trait automatically for all imported types in `#[wasm_bindgen] extern { ... }` blocks. The main change here was to generate an `instanceof` shim for all imported types in case it's needed. All imported types now also implement `AsRef<JsValue>` and `AsMut<JsValue>`
19 lines
276 B
JavaScript
19 lines
276 B
JavaScript
class JsCast1 {
|
|
constructor() {
|
|
this.val = 1;
|
|
}
|
|
myval() { return this.val; }
|
|
}
|
|
class JsCast2 {
|
|
}
|
|
class JsCast3 extends JsCast1 {
|
|
constructor() {
|
|
super();
|
|
this.val = 3;
|
|
}
|
|
}
|
|
|
|
exports.JsCast1 = JsCast1;
|
|
exports.JsCast2 = JsCast2;
|
|
exports.JsCast3 = JsCast3;
|