diff --git a/vendor/brr_lwd_ui/bindings/yjs/doc.ml b/vendor/brr_lwd_ui/bindings/yjs/doc.ml index 439d4d7..023d91a 100644 --- a/vendor/brr_lwd_ui/bindings/yjs/doc.ml +++ b/vendor/brr_lwd_ui/bindings/yjs/doc.ml @@ -218,4 +218,8 @@ module Doc = struct Jv.call t "getMap" [| Jv.of_string name |] |> Map.of_jv let make () = Jv.new' global [||] + + let transact t f = + let callback = Jv.callback ~arity:1 f in + Jv.call t "transact" [| callback |] |> ignore end diff --git a/vendor/brr_lwd_ui/bindings/yjs/doc.mli b/vendor/brr_lwd_ui/bindings/yjs/doc.mli index 6fc47ae..048cc20 100644 --- a/vendor/brr_lwd_ui/bindings/yjs/doc.mli +++ b/vendor/brr_lwd_ui/bindings/yjs/doc.mli @@ -65,4 +65,8 @@ module Doc : sig val make : unit -> t val get_array : t -> string -> Array.t val get_map : t -> string -> Map.t + + val transact : t -> (unit -> unit) -> unit + (** Bundles multiple operations into one transaction. Observer calls and the + update event will be called only once per transaction. *) end