From 66d74c1e74c34bde619cfa455394e5e4c3cf5266 Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Tue, 7 Nov 2023 23:59:44 +0800 Subject: [PATCH] feat(wasm): get deep value --- crates/loro-wasm/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/loro-wasm/src/lib.rs b/crates/loro-wasm/src/lib.rs index 6c7ce500..f11518ed 100644 --- a/crates/loro-wasm/src/lib.rs +++ b/crates/loro-wasm/src/lib.rs @@ -552,6 +552,12 @@ impl Loro { let f = self.0.oplog().lock().unwrap().dag().vv_to_frontiers(&vv); Ok(frontiers_to_ids(&f)) } + + #[wasm_bindgen(js_name = "getDeepValue")] + pub fn get_deep_value(&self) -> JsValue { + let value = self.0.get_deep_value(); + JsValue::from(value) + } } fn js_map_to_vv(map: js_sys::Map) -> JsResult { @@ -852,7 +858,7 @@ impl LoroMap { self.0.get_deep_value().into() } - #[wasm_bindgen(js_name = "insertContainer")] + #[wasm_bindgen(js_name = "setContainer")] pub fn insert_container(&mut self, key: &str, container_type: &str) -> JsResult { let type_ = match container_type { "text" | "Text" => ContainerType::Text,