Logo
Explore Help
Sign In
fluencelabs/wasm-bindgen
1
0
Fork 0
You've already forked wasm-bindgen
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-05-08 20:12:16 +00:00
Code Issues Projects Releases Wiki Activity
wasm-bindgen/tests/wasm/final.js

26 lines
326 B
JavaScript
Raw Normal View History

Switch all imports to `structural` by default This commit switches all imports of JS methods to `structural` by default. Proposed in [RFC 5] this should increase the performance of bindings today while also providing future-proofing for possible confusion with the recent addition of the `Deref` trait for all imported types by default as well. A new attribute, `host_binding`, is introduced in this PR as well to recover the old behavior of binding directly to an imported function which will one day be the precise function on the prototype. Eventually `web-sys` will switcsh over entirely to being driven via `host_binding` methods, but for now it's been measured to be not quite as fast so we're not making that switch yet. Note that `host_binding` differs from the proposed name of `final` due to the controversy, and its hoped that `host_binding` is a good middle-ground! [RFC 5]: https://rustwasm.github.io/rfcs/005-structural-and-deref.html
2018-11-08 13:18:58 -08:00
const assert = require('assert');
exports.MyType = class {
static foo(y) {
assert.equal(y, 'x');
return y + 'y';
}
constructor(x) {
assert.equal(x, 2);
this._a = 1;
}
bar(x) {
assert.equal(x, true);
return 3.2;
}
get a() {
return this._a;
}
set a(v) {
this._a = v;
}
};
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.7 Page: 73ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API