From 25ae9f3236ec3b7acb27a7f81b897b8bf647c950 Mon Sep 17 00:00:00 2001 From: synix Date: Thu, 25 Apr 2024 11:03:17 +0800 Subject: [PATCH 1/5] remove unused _transaction in YArray --- src/types/YArray.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/YArray.js b/src/types/YArray.js index ce60de78..217c154e 100644 --- a/src/types/YArray.js +++ b/src/types/YArray.js @@ -32,7 +32,6 @@ export class YArrayEvent extends YEvent { */ constructor (yarray, transaction) { super(yarray, transaction) - this._transaction = transaction } } From f0dc53f53f4c2fdf90a2701df73f73b6c2f06395 Mon Sep 17 00:00:00 2001 From: synix Date: Thu, 25 Apr 2024 11:17:49 +0800 Subject: [PATCH 2/5] fix minor typos --- src/utils/Transaction.js | 2 +- src/utils/encoding.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/Transaction.js b/src/utils/Transaction.js index 829589ec..9792d32e 100644 --- a/src/utils/Transaction.js +++ b/src/utils/Transaction.js @@ -225,7 +225,7 @@ const tryGcDeleteSet = (ds, store, gcFilter) => { */ const tryMergeDeleteSet = (ds, store) => { // 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) => { const structs = /** @type {Array} */ (store.clients.get(client)) for (let di = deleteItems.length - 1; di >= 0; di--) { diff --git a/src/utils/encoding.js b/src/utils/encoding.js index 2277a140..08a9602d 100644 --- a/src/utils/encoding.js +++ b/src/utils/encoding.js @@ -154,7 +154,7 @@ export const readClientsStructRefs = (decoder, doc) => { // @type {string|null} const struct = new Item( createID(client, clock), - null, // leftd + null, // left (info & binary.BIT8) === binary.BIT8 ? decoder.readLeftID() : null, // origin null, // right (info & binary.BIT7) === binary.BIT7 ? decoder.readRightID() : null, // right origin @@ -178,7 +178,7 @@ export const readClientsStructRefs = (decoder, doc) => { const struct = new Item( createID(client, clock), - null, // leftd + null, // left origin, // origin null, // right rightOrigin, // right origin @@ -370,7 +370,7 @@ export const writeStructsFromTransaction = (encoder, transaction) => writeClient /** * 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 {Doc} ydoc @@ -451,7 +451,7 @@ export const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = n /** * 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 {Doc} ydoc From 43815d8292d19be4ec2d3cfed4574bef3521ac9a Mon Sep 17 00:00:00 2001 From: synix Date: Thu, 25 Apr 2024 11:33:36 +0800 Subject: [PATCH 3/5] fix lint error --- src/types/YArray.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/types/YArray.js b/src/types/YArray.js index 217c154e..2afdb7e6 100644 --- a/src/types/YArray.js +++ b/src/types/YArray.js @@ -25,15 +25,7 @@ import { typeListSlice } from './AbstractType.js' * @template T * @extends YEvent> */ -export class YArrayEvent extends YEvent { - /** - * @param {YArray} yarray The changed type - * @param {Transaction} transaction The transaction object - */ - constructor (yarray, transaction) { - super(yarray, transaction) - } -} +export class YArrayEvent extends YEvent {} /** * A shared Array implementation. From 387be70ae96e884dab468f73aaf776616b062d0b Mon Sep 17 00:00:00 2001 From: synix Date: Fri, 26 Apr 2024 11:49:52 +0800 Subject: [PATCH 4/5] make slice() function's doc more accurate --- src/types/YArray.js | 6 +++--- src/types/YXmlFragment.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/types/YArray.js b/src/types/YArray.js index 2afdb7e6..609247bd 100644 --- a/src/types/YArray.js +++ b/src/types/YArray.js @@ -162,9 +162,9 @@ export class YArray extends AbstractType { } /** - * Preppends content to this YArray. + * Prepends content to this YArray. * - * @param {Array} content Array of content to preppend. + * @param {Array} content Array of content to prepend. */ unshift (content) { this.insert(0, content) @@ -206,7 +206,7 @@ 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} [end] diff --git a/src/types/YXmlFragment.js b/src/types/YXmlFragment.js index 2f37684a..16b54985 100644 --- a/src/types/YXmlFragment.js +++ b/src/types/YXmlFragment.js @@ -380,9 +380,9 @@ export class YXmlFragment extends AbstractType { } /** - * Preppends content to this YArray. + * Prepends content to this YArray. * - * @param {Array} content Array of content to preppend. + * @param {Array} content Array of content to prepend. */ unshift (content) { this.insert(0, content) @@ -399,7 +399,7 @@ 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} [end] From 3df335cb4cc1db585c2eb7af8942e99e9256ece2 Mon Sep 17 00:00:00 2001 From: synix Date: Fri, 26 Apr 2024 12:03:28 +0800 Subject: [PATCH 5/5] update slice() function's doc --- src/types/YArray.js | 3 ++- src/types/YXmlFragment.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/types/YArray.js b/src/types/YArray.js index 609247bd..38b4e11f 100644 --- a/src/types/YArray.js +++ b/src/types/YArray.js @@ -206,7 +206,8 @@ export class YArray extends AbstractType { } /** - * Returns a portion of this YArray into a JavaScript Array selected from start to end (end not included). + * Returns a portion of this YArray into a JavaScript Array selected + * from start to end (end not included). * * @param {number} [start] * @param {number} [end] diff --git a/src/types/YXmlFragment.js b/src/types/YXmlFragment.js index 16b54985..1445139c 100644 --- a/src/types/YXmlFragment.js +++ b/src/types/YXmlFragment.js @@ -399,7 +399,8 @@ export class YXmlFragment extends AbstractType { } /** - * Returns a portion of this YXmlFragment into a JavaScript Array selected from start to end (end not included). + * Returns a portion of this YXmlFragment into a JavaScript Array selected + * from start to end (end not included). * * @param {number} [start] * @param {number} [end]