mirror of
https://codeberg.org/demostf/tf-demos-viewer.git
synced 2026-06-03 18:14:11 +02:00
init repo
This commit is contained in:
commit
4882477d73
10 changed files with 5912 additions and 0 deletions
27
src/lib.rs
Normal file
27
src/lib.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::console;
|
||||
|
||||
|
||||
// When the `wee_alloc` feature is enabled, this uses `wee_alloc` as the global
|
||||
// allocator.
|
||||
//
|
||||
// If you don't want to use `wee_alloc`, you can safely delete this.
|
||||
#[cfg(feature = "wee_alloc")]
|
||||
#[global_allocator]
|
||||
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
||||
|
||||
|
||||
// This is like the `main` function, except for JavaScript.
|
||||
#[wasm_bindgen(start)]
|
||||
pub fn main_js() -> Result<(), JsValue> {
|
||||
// This provides better error messages in debug mode.
|
||||
// It's disabled in release mode so it doesn't bloat up the file size.
|
||||
#[cfg(debug_assertions)]
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
|
||||
// Your code goes here!
|
||||
console::log_1(&JsValue::from_str("Hello world!"));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue