Updated the deps and package in www
This commit is contained in:
parent
e7b88b96e1
commit
fd8f0e772c
@ -44,5 +44,8 @@ wasm-bindgen-test = "0.3.13"
|
|||||||
# Tell `rustc` to optimize for small code size.
|
# Tell `rustc` to optimize for small code size.
|
||||||
opt-level = "s"
|
opt-level = "s"
|
||||||
|
|
||||||
|
[package.metadata.wasm-pack.profile.dev]
|
||||||
|
wasm-opt = false
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.release]
|
[package.metadata.wasm-pack.profile.release]
|
||||||
wasm-opt = false
|
wasm-opt = false
|
11
src/lib.rs
11
src/lib.rs
@ -1,8 +1,8 @@
|
|||||||
use wasm_bindgen::prelude::*;
|
|
||||||
use math;
|
|
||||||
|
|
||||||
extern crate web_sys;
|
extern crate web_sys;
|
||||||
|
|
||||||
|
use math;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
||||||
@ -16,6 +16,11 @@ pub fn run() {
|
|||||||
log("[WASM] internal logging...");
|
log("[WASM] internal logging...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn sample() -> String {
|
||||||
|
"hello".into()
|
||||||
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern {
|
extern {
|
||||||
fn alert(s: &str);
|
fn alert(s: &str);
|
||||||
|
13
www/index.ts
13
www/index.ts
@ -1,8 +1,7 @@
|
|||||||
// import * as wasm from "hello-wasm-pack";
|
// import * as wasm from "hello-wasm-pack";
|
||||||
// import * as wasm from 'wasmweb-sample'
|
// @ts-ignore
|
||||||
//
|
import {just_sum,log} from 'wasmweb-sample'
|
||||||
// wasm.log("[WEB] external logging...")
|
|
||||||
//
|
log("d")
|
||||||
// const greeting = wasm.greet()
|
const sum = just_sum()
|
||||||
// const sum = wasm.just_sum()
|
console.log("Sum of number", sum)
|
||||||
// console.log("Sum of number", sum)
|
|
||||||
|
@ -33,5 +33,8 @@
|
|||||||
"webpack": "^4.29.3",
|
"webpack": "^4.29.3",
|
||||||
"webpack-cli": "^3.1.0",
|
"webpack-cli": "^3.1.0",
|
||||||
"webpack-dev-server": "^3.1.5"
|
"webpack-dev-server": "^3.1.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"wasmweb-sample": "file:../pkg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user