hello-wasm 0.1.1

A sample project with wasm-pack
Documentation
extern crate wasm_bindgen;

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
extern "C" {
    pub fn alert(s: &str);
}

#[wasm_bindgen]
pub fn greet(name: &str) {
    alert(&format!("Hello, {}!", name));
}
use std::sync::{Arc, Mutex};
use std::thread;

#[wasm_bindgen]
pub fn count() {
    let counter = Arc::new(Mutex::new(0));
    let mut handles = vec![];

    for _ in 0..10 {
        let counter = Arc::clone(&counter);
        let handle = thread::spawn(move || {
            let mut num = counter.lock().unwrap();

            *num += 1;
        });
        handles.push(handle);
    }

    for handle in handles {
        handle.join().unwrap();
    }

    println!("Result: {}", *counter.lock().unwrap());
    // counter.lock().unwrap()
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_count() {
        count();
        assert!(true);
    }
}