wasm-bindgen/tests/wasm/jscast.js
Alex Crichton 11553a1af2 Implement JsCast for all imported types
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>`
2018-08-07 12:59:51 -07:00

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;