mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-15 22:11:23 +00:00
Rewrite the README using Webpack
Right now Webpack probably has the most mature support for loading wasm modules, so let's show off how to do that! Additionally this commits hello world as an example to the repository.
This commit is contained in:
16
examples/hello_world/src/lib.rs
Normal file
16
examples/hello_world/src/lib.rs
Normal file
@ -0,0 +1,16 @@
|
||||
#![feature(proc_macro)]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern {
|
||||
fn alert(s: &str);
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
#[no_mangle]
|
||||
pub extern fn greet(name: &str) {
|
||||
alert(&format!("Hello, {}!", name));
|
||||
}
|
Reference in New Issue
Block a user