chore(y-octo): migrate away depracated JsExternal API (#12130)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
  - Updated usage of JavaScript interop types to newer API versions for improved compatibility and consistency.
  - Changed method and type signatures to use updated types in several areas.
  - Removed an unused constructor from one component.
  - Adjusted a method to use a different JavaScript array buffer type for update callbacks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Brooooooklyn
2025-05-06 07:24:54 +00:00
parent 245db4e992
commit 83f7093144
4 changed files with 42 additions and 33 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
use napi::{
bindgen_prelude::{Buffer, Uint8Array},
bindgen_prelude::Uint8Array,
threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode},
};
use y_octo::{CrdtRead, Doc as YDoc, History, RawDecoder, StateVector};
@@ -120,7 +120,7 @@ impl Doc {
}
#[napi(ts_args_type = "callback: (result: Uint8Array) => void")]
pub fn on_update(&mut self, callback: ThreadsafeFunction<Buffer>) -> Result<()> {
pub fn on_update(&mut self, callback: ThreadsafeFunction<Uint8Array>) -> Result<()> {
let callback = move |update: &[u8], _h: &[History]| {
callback.call(
Ok(update.to_vec().into()),