mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-24 10:11:34 +00:00
Guarantee static_method_of
uses the right this
(#1795)
This came up during #1760 where `Promise.resolve` must be invoked with `this` as the `Promise` object, but we were erroneously importing it in such a way that it didn't have a shim and `this` was `undefined`.
This commit is contained in:
@ -23,3 +23,6 @@ let instant = Date::now();
|
||||
|
||||
This is similar to the `js_namespace` attribute, but the usage from within Rust
|
||||
is different since the method also becomes a static method of the imported type.
|
||||
Additionally this attribute also specifies that the `this` parameter when
|
||||
invoking the method is expected to be the JS class, e.g. always invoked as
|
||||
`Date.now()` instead of `const x = Date.now; x()`.
|
||||
|
Reference in New Issue
Block a user