(wasm) Cleanup and refactoring, add TableDB transactions, copy over docs for JSDoc.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_arch = "wasm32")] {
|
||||
pub use tsify::*;
|
||||
@@ -19,3 +21,18 @@ cfg_if::cfg_if! {
|
||||
}
|
||||
}
|
||||
pub(crate) use from_impl_to_jsvalue;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(typescript_type = "string[]")]
|
||||
pub type StringArray;
|
||||
}
|
||||
|
||||
/// Convert a `Vec<String>` into a `js_sys::Array` with the type of `string[]`
|
||||
pub(crate) fn into_unchecked_string_array(items: Vec<String>) -> StringArray {
|
||||
items
|
||||
.iter()
|
||||
.map(JsValue::from)
|
||||
.collect::<js_sys::Array>()
|
||||
.unchecked_into::<StringArray>() // TODO: can I do this a better way?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user