Reorganize the import_js example

This commit is contained in:
Alex Crichton 2019-03-25 13:49:05 -07:00
parent 362777fc75
commit faf49c7d56
7 changed files with 5 additions and 5 deletions

View File

@ -66,7 +66,7 @@ members = [
"examples/fetch", "examples/fetch",
"examples/guide-supported-types-examples", "examples/guide-supported-types-examples",
"examples/hello_world", "examples/hello_world",
"examples/import_js", "examples/import_js/crate",
"examples/julia_set", "examples/julia_set",
"examples/paint", "examples/paint",
"examples/performance", "examples/performance",

View File

@ -1,4 +1,4 @@
// For more comments about what's going on here, check out the `hello_world` // For more comments about what's going on here, check out the `hello_world`
// example // example
import('./pkg/import_js') import('./crate/pkg/import_js')
.catch(console.error); .catch(console.error);

View File

@ -14,7 +14,7 @@ module.exports = {
template: 'index.html' template: 'index.html'
}), }),
new WasmPackPlugin({ new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".") crateDirectory: path.resolve(__dirname, "crate")
}), }),
// Have this example work in Edge which doesn't ship `TextEncoder` or // Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time. // `TextDecoder` at this time.

View File

@ -13,13 +13,13 @@ For example if you're working with this JS file:
```js ```js
// defined-in-js.js // defined-in-js.js
{{#include ../../../examples/import_js/defined-in-js.js}} {{#include ../../../examples/import_js/crate/defined-in-js.js}}
``` ```
you can use it in Rust with: you can use it in Rust with:
```rust ```rust
{{#include ../../../examples/import_js/src/lib.rs}} {{#include ../../../examples/import_js/crate/src/lib.rs}}
``` ```
You can also [explore the full list of ways to configure imports][attr] You can also [explore the full list of ways to configure imports][attr]