Merge pull request #635 from synix/fix/unused-transaction

remove unused _transaction in YArrayEvent
This commit is contained in:
Kevin Jahns 2024-04-28 21:08:58 +02:00 committed by GitHub
commit 0511b66346
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 21 deletions

View File

@ -25,16 +25,7 @@ import { typeListSlice } from './AbstractType.js'
* @template T * @template T
* @extends YEvent<YArray<T>> * @extends YEvent<YArray<T>>
*/ */
export class YArrayEvent extends YEvent { export class YArrayEvent extends YEvent {}
/**
* @param {YArray<T>} yarray The changed type
* @param {Transaction} transaction The transaction object
*/
constructor (yarray, transaction) {
super(yarray, transaction)
this._transaction = transaction
}
}
/** /**
* A shared Array implementation. * A shared Array implementation.
@ -171,9 +162,9 @@ export class YArray extends AbstractType {
} }
/** /**
* Preppends content to this YArray. * Prepends content to this YArray.
* *
* @param {Array<T>} content Array of content to preppend. * @param {Array<T>} content Array of content to prepend.
*/ */
unshift (content) { unshift (content) {
this.insert(0, content) this.insert(0, content)
@ -215,7 +206,8 @@ export class YArray extends AbstractType {
} }
/** /**
* Transforms this YArray to a JavaScript Array. * Returns a portion of this YArray into a JavaScript Array selected
* from start to end (end not included).
* *
* @param {number} [start] * @param {number} [start]
* @param {number} [end] * @param {number} [end]

View File

@ -380,9 +380,9 @@ export class YXmlFragment extends AbstractType {
} }
/** /**
* Preppends content to this YArray. * Prepends content to this YArray.
* *
* @param {Array<YXmlElement|YXmlText>} content Array of content to preppend. * @param {Array<YXmlElement|YXmlText>} content Array of content to prepend.
*/ */
unshift (content) { unshift (content) {
this.insert(0, content) this.insert(0, content)
@ -399,7 +399,8 @@ export class YXmlFragment extends AbstractType {
} }
/** /**
* Transforms this YArray to a JavaScript Array. * Returns a portion of this YXmlFragment into a JavaScript Array selected
* from start to end (end not included).
* *
* @param {number} [start] * @param {number} [start]
* @param {number} [end] * @param {number} [end]

View File

@ -225,7 +225,7 @@ const tryGcDeleteSet = (ds, store, gcFilter) => {
*/ */
const tryMergeDeleteSet = (ds, store) => { const tryMergeDeleteSet = (ds, store) => {
// try to merge deleted / gc'd items // try to merge deleted / gc'd items
// merge from right to left for better efficiecy and so we don't miss any merge targets // merge from right to left for better efficiency and so we don't miss any merge targets
ds.clients.forEach((deleteItems, client) => { ds.clients.forEach((deleteItems, client) => {
const structs = /** @type {Array<GC|Item>} */ (store.clients.get(client)) const structs = /** @type {Array<GC|Item>} */ (store.clients.get(client))
for (let di = deleteItems.length - 1; di >= 0; di--) { for (let di = deleteItems.length - 1; di >= 0; di--) {

View File

@ -154,7 +154,7 @@ export const readClientsStructRefs = (decoder, doc) => {
// @type {string|null} // @type {string|null}
const struct = new Item( const struct = new Item(
createID(client, clock), createID(client, clock),
null, // leftd null, // left
(info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin
null, // right null, // right
(info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin
@ -178,7 +178,7 @@ export const readClientsStructRefs = (decoder, doc) => {
const struct = new Item( const struct = new Item(
createID(client, clock), createID(client, clock),
null, // leftd null, // left
origin, // origin origin, // origin
null, // right null, // right
rightOrigin, // right origin rightOrigin, // right origin
@ -370,7 +370,7 @@ export const writeStructsFromTransaction = (encoder, transaction) => writeClient
/** /**
* Read and apply a document update. * Read and apply a document update.
* *
* This function has the same effect as `applyUpdate` but accepts an decoder. * This function has the same effect as `applyUpdate` but accepts a decoder.
* *
* @param {decoding.Decoder} decoder * @param {decoding.Decoder} decoder
* @param {Doc} ydoc * @param {Doc} ydoc
@ -451,7 +451,7 @@ export const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = n
/** /**
* Read and apply a document update. * Read and apply a document update.
* *
* This function has the same effect as `applyUpdate` but accepts an decoder. * This function has the same effect as `applyUpdate` but accepts a decoder.
* *
* @param {decoding.Decoder} decoder * @param {decoding.Decoder} decoder
* @param {Doc} ydoc * @param {Doc} ydoc