mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-23 05:25:53 +08:00
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:
@@ -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()),
|
||||
|
||||
Reference in New Issue
Block a user