mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
chore(js): updated callback functions names
This commit is contained in:
parent
6ea5a72b0c
commit
fc9247c5a8
2 changed files with 13 additions and 2 deletions
|
@ -9,7 +9,7 @@ use crate::buffer::controller::BufferController;
|
|||
impl BufferController {
|
||||
|
||||
#[napi(js_name = "callback", ts_args_type = "fun: (event: BufferController) => void")]
|
||||
pub fn jscallback(&self, fun: napi::JsFunction) -> napi::Result<()>{
|
||||
pub fn js_callback(&self, fun: napi::JsFunction) -> napi::Result<()>{
|
||||
let tsfn : ThreadsafeFunction<crate::buffer::controller::BufferController, Fatal> =
|
||||
fun.create_threadsafe_function(0,
|
||||
|ctx : ThreadSafeCallContext<crate::buffer::controller::BufferController>| {
|
||||
|
@ -26,12 +26,23 @@ impl BufferController {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[napi(js_name = "clear_callback")]
|
||||
pub fn js_clear_callback(&self) -> napi::Result<()> {
|
||||
self.clear_callback();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
#[napi(js_name = "get_name")]
|
||||
pub fn js_name(&self) -> napi::Result<&str> {
|
||||
Ok(&self.name())
|
||||
}
|
||||
|
||||
#[napi(js_name = "poll")]
|
||||
pub async fn js_poll(&self) -> napi::Result<()>{
|
||||
Ok(self.poll().await?)
|
||||
}
|
||||
|
||||
#[napi(js_name = "try_recv")]
|
||||
pub async fn js_try_recv(&self) -> napi::Result<Option<TextChange>> {
|
||||
Ok(self.try_recv().await?)
|
||||
|
|
|
@ -45,7 +45,7 @@ impl From<crate::api::Cursor> for JsCursor {
|
|||
impl CursorController {
|
||||
|
||||
#[napi(js_name = "callback", ts_args_type = "fun: (event: CursorController) => void")]
|
||||
pub fn jscallback(&self, fun: napi::JsFunction) -> napi::Result<()>{
|
||||
pub fn js_callback(&self, fun: napi::JsFunction) -> napi::Result<()>{
|
||||
let tsfn : ThreadsafeFunction<crate::cursor::controller::CursorController, Fatal> =
|
||||
fun.create_threadsafe_function(0,
|
||||
|ctx : ThreadSafeCallContext<crate::cursor::controller::CursorController>| {
|
||||
|
|
Loading…
Reference in a new issue