Add new VeilidTable and VeilidClient to WASM API

These new interfaces have been reworked (compared to the original API) to emit (mostly) proper TypeScript types.
This commit is contained in:
Brandon Vandegrift
2023-08-18 18:32:04 -04:00
parent 0abc9a8b45
commit 779532b624
5 changed files with 347 additions and 2 deletions

View File

@@ -25,6 +25,9 @@ use veilid_core::*;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::*;
pub mod veilid_client_js;
pub mod veilid_table_js;
// Allocator
extern crate wee_alloc;
#[global_allocator]
@@ -385,7 +388,7 @@ pub fn routing_context_app_message(id: u32, target_string: String, message: Stri
let routing_context = {
let rc = (*ROUTING_CONTEXTS).borrow();
let Some(routing_context) = rc.get(&id) else {
return APIResult::Err(veilid_core::VeilidAPIError::invalid_argument("routing_context_app_call", "id", id));
return APIResult::Err(veilid_core::VeilidAPIError::invalid_argument("routing_context_app_message", "id", id));
};
routing_context.clone()
};
@@ -1460,7 +1463,8 @@ pub fn veilid_version_string() -> String {
veilid_core::veilid_version_string()
}
#[derive(Serialize)]
#[derive(Serialize, Tsify)]
#[tsify(into_wasm_abi)]
pub struct VeilidVersion {
pub major: u32,
pub minor: u32,