dioxus stuff

This commit is contained in:
2024-05-21 21:13:19 -04:00
parent a04238dbcd
commit 7fb6e95c79
8 changed files with 2641 additions and 28 deletions
+6 -9
View File
@@ -1,18 +1,17 @@
pub mod app;
use wasm_bindgen::prelude::*;
use web_sys::console;
use web_sys::WebTransport;
use web_sys::WebTransportOptions;
use web_sys::js_sys::Promise;
#[wasm_bindgen]
extern "C" {
pub fn alert(s: &str);
}
#[wasm_bindgen]
//pub async fn entrypoint() -> std::result::Result<(), wasm_bindgen::JsValue> {
pub async fn entrypoint() -> JsValue {
pub async fn network_entrypoint() {
console::log_1(&"Rust via WASM!".into());
let server_hash = vec![
@@ -58,7 +57,7 @@ pub async fn entrypoint() -> JsValue {
console::log_1(&transport.clone().into());
if let Err(e) = wasm_bindgen_futures::JsFuture::from(transport.ready()).await {
if let Err(e) = wasm_bindgen_futures::JsFuture::from(transport.ready()).await {
console::log_1(&e.into());
panic!();
}
@@ -67,9 +66,7 @@ pub async fn entrypoint() -> JsValue {
let stream: web_sys::WebTransportBidirectionalStream =
match wasm_bindgen_futures::JsFuture::from(transport.create_bidirectional_stream()).await {
Ok(x) => {
x.into()
}
Ok(x) => x.into(),
Err(e) => {
console::log_1(&e.into());
panic!();
@@ -80,5 +77,5 @@ pub async fn entrypoint() -> JsValue {
//let writer = stream.writable();
console::log_1(&"Created bidirectional stream!".into());
return stream.into();
console::log_1(&stream.into());
}