Readme tweaks (#606)

* Use ES modules in README example

* Remove introduction blog post from README

While the blog post is great, the README and the guide should be a good enough
intro to wasm-bindgen, and are more likely to be kept up to date.
This commit is contained in:
Nick Fitzgerald 2018-08-01 16:42:23 -07:00 committed by Alex Crichton
parent c4dcaee1b9
commit ae7a9a7394

View File

@ -4,11 +4,6 @@
**Facilitating high-level interactions between wasm modules and JavaScript.**
[Introduction blog post: "JavaScript to Rust and Back Again: A `wasm-bindgen` Tale"][post]
[host]: https://github.com/WebAssembly/host-bindings
[post]: https://hacks.mozilla.org/2018/04/javascript-to-rust-and-back-again-a-wasm-bindgen-tale/
[![Build Status](https://travis-ci.org/rustwasm/wasm-bindgen.svg?branch=master)](https://travis-ci.org/rustwasm/wasm-bindgen)
[![Build status](https://ci.appveyor.com/api/projects/status/559c0lj5oh271u4c?svg=true)](https://ci.appveyor.com/project/alexcrichton/wasm-bindgen)
[![](http://meritbadge.herokuapp.com/wasm-bindgen)](https://crates.io/crates/wasm-bindgen)
@ -17,8 +12,6 @@
Import JavaScript things into Rust and export Rust things to JavaScript.
`src/lib.rs`:
```rust
#![feature(use_extern_macros)]
@ -39,17 +32,12 @@ pub fn greet(name: &str) {
}
```
Use exported Rust things from JavaScript!
`index.js`:
Use exported Rust things from JavaScript with ECMAScript modules!
```js
// Asynchronously load, compile, and import the Rust's WebAssembly
// and JavaScript interface.
import("./hello_world").then(module => {
// Alert "Hello, World!"
module.greet("World!");
});
import { greet } from "./hello_world";
greet("World!");
```
## Guide