feat(wasm): get deep value

This commit is contained in:
Zixuan Chen 2023-11-07 23:59:44 +08:00
parent 7b855c88da
commit 66d74c1e74
No known key found for this signature in database

View file

@ -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<VersionVector> {
@ -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<JsValue> {
let type_ = match container_type {
"text" | "Text" => ContainerType::Text,