Comparing version 13.5.48 to 13.5.49
@@ -100,3 +100,3 @@ /** | ||
export function tryGc(ds: DeleteSet, store: StructStore, gcFilter: (arg0: Item) => boolean): void; | ||
export function transact(doc: Doc, f: (arg0: Transaction) => void, origin?: any, local?: boolean): void; | ||
export function transact<T>(doc: Doc, f: (arg0: Transaction) => T, origin?: any, local?: boolean): T; | ||
import { Doc } from "./Doc.js"; | ||
@@ -103,0 +103,0 @@ import { DeleteSet } from "./DeleteSet.js"; |
{ | ||
"name": "yjs", | ||
"version": "13.5.48", | ||
"version": "13.5.49", | ||
"description": "Shared Editing Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/yjs.cjs", |
@@ -260,3 +260,4 @@ /** | ||
toString () { | ||
return typeListMap(this, xml => xml.toString()).join('') | ||
// toString can result in many cleanup transactions. We wrap all cleanup transactions here to reduce the work | ||
return transact(/** @type {Doc} */ (this.doc), () => typeListMap(this, xml => xml.toString()).join('')) | ||
} | ||
@@ -263,0 +264,0 @@ |
@@ -379,5 +379,7 @@ | ||
* | ||
* @template T | ||
* @param {Doc} doc | ||
* @param {function(Transaction):void} f | ||
* @param {function(Transaction):T} f | ||
* @param {any} [origin=true] | ||
* @return {T} | ||
* | ||
@@ -389,2 +391,6 @@ * @function | ||
let initialCall = false | ||
/** | ||
* @type {any} | ||
*/ | ||
let result = null | ||
if (doc._transaction === null) { | ||
@@ -400,3 +406,3 @@ initialCall = true | ||
try { | ||
f(doc._transaction) | ||
result = f(doc._transaction) | ||
} finally { | ||
@@ -419,2 +425,3 @@ if (initialCall) { | ||
} | ||
return result | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2133184
32957