mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-23 05:14:54 +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")]
|
||||
pub fn js_send(&self, op: TextChange) -> napi::Result<()> {
|
||||
Ok(self.send(op)?)
|
||||
pub async fn js_send(&self, op: TextChange) -> napi::Result<()> {
|
||||
Ok(self.send(op).await?)
|
||||
}
|
||||
}
|
|
@ -66,13 +66,14 @@ impl CodempCursorController {
|
|||
}
|
||||
|
||||
#[napi(js_name = "send")]
|
||||
pub fn js_send(&self, pos: JsCursor) -> napi::Result<()> {
|
||||
Ok(self.send(crate::api::Cursor::from(pos))?)
|
||||
pub async fn js_send(&self, pos: JsCursor) -> napi::Result<()> {
|
||||
Ok(self.send(crate::api::Cursor::from(pos)).await?)
|
||||
}
|
||||
|
||||
|
||||
#[napi(js_name= "try_recv")]
|
||||
pub fn js_try_recv(&self) -> napi::Result<Option<JsCursor>> {
|
||||
Ok(self.try_recv()?.map(|x| JsCursor::from(x)))
|
||||
pub async fn js_try_recv(&self) -> napi::Result<Option<JsCursor>> {
|
||||
Ok(self.try_recv().await?
|
||||
.map(|x| JsCursor::from(x)))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue