mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 23:34:49 +01:00
chore: updated js glue to have async send/recv
This commit is contained in:
parent
8806941a13
commit
b46914528a
2 changed files with 7 additions and 6 deletions
|
@ -37,7 +37,7 @@ impl CodempBufferController {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[napi(js_name = "send")]
|
#[napi(js_name = "send")]
|
||||||
pub fn js_send(&self, op: TextChange) -> napi::Result<()> {
|
pub async fn js_send(&self, op: TextChange) -> napi::Result<()> {
|
||||||
Ok(self.send(op)?)
|
Ok(self.send(op).await?)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -66,13 +66,14 @@ impl CodempCursorController {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[napi(js_name = "send")]
|
#[napi(js_name = "send")]
|
||||||
pub fn js_send(&self, pos: JsCursor) -> napi::Result<()> {
|
pub async fn js_send(&self, pos: JsCursor) -> napi::Result<()> {
|
||||||
Ok(self.send(crate::api::Cursor::from(pos))?)
|
Ok(self.send(crate::api::Cursor::from(pos)).await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[napi(js_name= "try_recv")]
|
#[napi(js_name= "try_recv")]
|
||||||
pub fn js_try_recv(&self) -> napi::Result<Option<JsCursor>> {
|
pub async fn js_try_recv(&self) -> napi::Result<Option<JsCursor>> {
|
||||||
Ok(self.try_recv()?.map(|x| JsCursor::from(x)))
|
Ok(self.try_recv().await?
|
||||||
|
.map(|x| JsCursor::from(x)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue