-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from fitzgen/hyphens-and-underscores
fix: Handle both underscores and hypthens as separators in "wasm-bind…
- Loading branch information
Showing
6 changed files
with
72 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "with-underscores" | ||
version = "0.1.0" | ||
authors = ["Ashley Williams <ashley666ashley@gmail.com>"] | ||
license = "WTFPL" | ||
repository = "https://github.com/ashleygwilliams/wasm-pack" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
# Cargo will normalize "wasm-bindgen" and "wasm_bindgen" and that shouldn't | ||
# break wasm-pack. | ||
wasm_bindgen = "0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# js-hello-world | ||
> an example rust -> wasm project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![feature(use_extern_macros)] | ||
|
||
extern crate wasm_bindgen; | ||
|
||
use wasm_bindgen::prelude::*; | ||
|
||
// Import the `window.alert` function from the Web. | ||
#[wasm_bindgen] | ||
extern { | ||
fn alert(s: &str); | ||
} | ||
|
||
// Export a `greet` function from Rust to JavaScript, that alerts a | ||
// hello message. | ||
#[wasm_bindgen] | ||
pub fn greet(name: &str) { | ||
alert(&format!("Hello, {}!", name)); | ||
} |