mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-12 11:11:12 +03:00
bc36b6f84b
Some examples have been failing to load in some browsers, and this ensures that whenever the promise to load Rust code fails we log any errors happening instead of accidentally failing silently. This helped debug a bit in #897
9 lines
282 B
JavaScript
9 lines
282 B
JavaScript
// Note that a dynamic `import` statement here is required due to
|
|
// webpack/webpack#6615, but in theory `import { greet } from './hello_world';`
|
|
// will work here one day as well!
|
|
const rust = import('./hello_world');
|
|
|
|
rust
|
|
.then(m => m.greet('World!'))
|
|
.catch(console.error);
|