diff --git a/src/ffi/js/buffer.rs b/src/ffi/js/buffer.rs index 3ac8714..2f533da 100644 --- a/src/ffi/js/buffer.rs +++ b/src/ffi/js/buffer.rs @@ -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 = fun.create_threadsafe_function(0, |ctx : ThreadSafeCallContext| { @@ -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> { Ok(self.try_recv().await?) diff --git a/src/ffi/js/cursor.rs b/src/ffi/js/cursor.rs index b0f7bb6..1f1065c 100644 --- a/src/ffi/js/cursor.rs +++ b/src/ffi/js/cursor.rs @@ -45,7 +45,7 @@ impl From 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 = fun.create_threadsafe_function(0, |ctx : ThreadSafeCallContext| {