improve jsdoc comments

This commit is contained in:
Kevin Jahns
2019-04-11 13:18:35 +02:00
parent ed3b31e58f
commit 31ff7ac78c
32 changed files with 477 additions and 114 deletions

View File

@@ -33,6 +33,8 @@ import * as binary from 'lib0/binary.js'
* @param {AbstractItem} leftItem
* @param {number} diff
* @return {AbstractItem}
* @function
* @private
*/
export const splitItem = (transaction, leftItem, diff) => {
const id = leftItem.id
@@ -127,6 +129,7 @@ export class AbstractItem extends AbstractStruct {
/**
* @param {Transaction} transaction
* @private
*/
integrate (transaction) {
const store = transaction.y.store
@@ -257,6 +260,8 @@ export class AbstractItem extends AbstractStruct {
* @param {AbstractType<any>} parent
* @param {string | null} parentSub
* @return {AbstractItem}
*
* @private
*/
copy (id, left, origin, right, rightOrigin, parent, parentSub) {
throw new Error('unimplemented')
@@ -363,6 +368,8 @@ export class AbstractItem extends AbstractStruct {
* @param {Transaction} transaction
* @param {number} diff
* @return {AbstractItem}
*
* @private
*/
splitAt (transaction, diff) {
throw new Error('unimplemented')
@@ -371,6 +378,8 @@ export class AbstractItem extends AbstractStruct {
/**
* @param {AbstractItem} right
* @return {boolean}
*
* @private
*/
mergeWith (right) {
if (compareIDs(right.origin, this.lastId) && this.right === right && compareIDs(this.rightOrigin, right.rightOrigin)) {
@@ -386,8 +395,6 @@ export class AbstractItem extends AbstractStruct {
* Mark this Item as deleted.
*
* @param {Transaction} transaction
*
* @private
*/
delete (transaction) {
if (!this.deleted) {
@@ -405,12 +412,16 @@ export class AbstractItem extends AbstractStruct {
/**
* @param {Transaction} transaction
* @param {StructStore} store
*
* @private
*/
gcChildren (transaction, store) { }
/**
* @param {Transaction} transaction
* @param {StructStore} store
*
* @private
*/
gc (transaction, store) {
let r
@@ -449,6 +460,7 @@ export class AbstractItem extends AbstractStruct {
* @param {encoding.Encoder} encoder The encoder to write data to.
* @param {number} offset
* @param {number} encodingRef
*
* @private
*/
write (encoder, offset, encodingRef) {
@@ -487,6 +499,9 @@ export class AbstractItem extends AbstractStruct {
}
}
/**
* @private
*/
export class AbstractItemRef extends AbstractStructRef {
/**
* @param {decoding.Decoder} decoder
@@ -543,6 +558,9 @@ export class AbstractItemRef extends AbstractStructRef {
/**
* @param {AbstractItemRef} item
* @param {number} offset
*
* @function
* @private
*/
export const changeItemRefOffset = (item, offset) => {
item.id = createID(item.id.client, item.id.clock + offset)
@@ -561,6 +579,9 @@ export const changeItemRefOffset = (item, offset) => {
* @param {string|null} parentSub
* @param {string|null} parentYKey
* @return {{left:AbstractItem?,right:AbstractItem?,parent:AbstractType<YEvent>?,parentSub:string?}}
*
* @private
* @function
*/
export const computeItemParams = (transaction, store, leftid, rightid, parentid, parentSub, parentYKey) => {
const left = leftid === null ? null : getItemCleanEnd(transaction, store, leftid)

View File

@@ -6,7 +6,9 @@ import {
import * as encoding from 'lib0/encoding.js' // eslint-disable-line
import * as error from 'lib0/error.js'
// eslint-disable-next-line
/**
* @private
*/
export class AbstractStruct {
/**
* @param {ID} id
@@ -53,6 +55,9 @@ export class AbstractStruct {
}
}
/**
* @private
*/
export class AbstractStructRef {
/**
* @param {ID} id

View File

@@ -1,6 +1,4 @@
/**
* @module structs
*/
import {
AbstractStructRef,
AbstractStruct,
@@ -14,6 +12,9 @@ import * as encoding from 'lib0/encoding.js'
export const structGCRefNumber = 0
/**
* @private
*/
export class GC extends AbstractStruct {
/**
* @param {ID} id
@@ -60,6 +61,9 @@ export class GC extends AbstractStruct {
}
}
/**
* @private
*/
export class GCRef extends AbstractStructRef {
/**
* @param {decoding.Decoder} decoder

View File

@@ -1,6 +1,3 @@
/**
* @module structs
*/
import {
AbstractItem,
@@ -13,8 +10,14 @@ import {
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'
/**
* @private
*/
export const structBinaryRefNumber = 1
/**
* @private
*/
export class ItemBinary extends AbstractItem {
/**
* @param {ID} id
@@ -55,6 +58,9 @@ export class ItemBinary extends AbstractItem {
}
}
/**
* @private
*/
export class ItemBinaryRef extends AbstractItemRef {
/**
* @param {decoding.Decoder} decoder

View File

@@ -1,6 +1,3 @@
/**
* @module structs
*/
import {
AbstractItem,
@@ -16,8 +13,14 @@ import {
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'
/**
* @private
*/
export const structDeletedRefNumber = 2
/**
* @private
*/
export class ItemDeleted extends AbstractItem {
/**
* @param {ID} id
@@ -91,6 +94,9 @@ export class ItemDeleted extends AbstractItem {
}
}
/**
* @private
*/
export class ItemDeletedRef extends AbstractItemRef {
/**
* @param {decoding.Decoder} decoder

View File

@@ -1,6 +1,3 @@
/**
* @module structs
*/
import {
AbstractItem,
@@ -13,8 +10,14 @@ import {
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'
/**
* @private
*/
export const structEmbedRefNumber = 3
/**
* @private
*/
export class ItemEmbed extends AbstractItem {
/**
* @param {ID} id
@@ -52,6 +55,9 @@ export class ItemEmbed extends AbstractItem {
}
}
/**
* @private
*/
export class ItemEmbedRef extends AbstractItemRef {
/**
* @param {decoding.Decoder} decoder

View File

@@ -1,6 +1,3 @@
/**
* @module structs
*/
import {
AbstractItem,
@@ -13,8 +10,14 @@ import {
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'
/**
* @private
*/
export const structFormatRefNumber = 4
/**
* @private
*/
export class ItemFormat extends AbstractItem {
/**
* @param {ID} id
@@ -58,6 +61,9 @@ export class ItemFormat extends AbstractItem {
}
}
/**
* @private
*/
export class ItemFormatRef extends AbstractItemRef {
/**
* @param {decoding.Decoder} decoder

View File

@@ -1,6 +1,3 @@
/**
* @module structs
*/
import {
AbstractItem,
@@ -15,8 +12,14 @@ import {
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'
/**
* @private
*/
export const structJSONRefNumber = 5
/**
* @private
*/
export class ItemJSON extends AbstractItem {
/**
* @param {ID} id
@@ -92,6 +95,9 @@ export class ItemJSON extends AbstractItem {
}
}
/**
* @private
*/
export class ItemJSONRef extends AbstractItemRef {
/**
* @param {decoding.Decoder} decoder

View File

@@ -1,6 +1,4 @@
/**
* @module structs
*/
import {
AbstractItem,
AbstractItemRef,
@@ -16,6 +14,9 @@ import * as decoding from 'lib0/decoding.js'
export const structStringRefNumber = 6
/**
* @private
*/
export class ItemString extends AbstractItem {
/**
* @param {ID} id
@@ -88,6 +89,9 @@ export class ItemString extends AbstractItem {
}
}
/**
* @private
*/
export class ItemStringRef extends AbstractItemRef {
/**
* @param {decoding.Decoder} decoder

View File

@@ -1,6 +1,3 @@
/**
* @module structs
*/
import {
AbstractItem,
@@ -19,10 +16,14 @@ import {
import * as encoding from 'lib0/encoding.js' // eslint-disable-line
import * as decoding from 'lib0/decoding.js'
/**
* @private
*/
export const structTypeRefNumber = 7
/**
* @type {Array<function(decoding.Decoder):AbstractType<any>>}
* @private
*/
export const typeRefs = [
readYArray,
@@ -42,6 +43,9 @@ export const YXmlFragmentRefID = 4
export const YXmlHookRefID = 5
export const YXmlTextRefID = 6
/**
* @private
*/
export class ItemType extends AbstractItem {
/**
* @param {ID} id
@@ -133,6 +137,9 @@ export class ItemType extends AbstractItem {
}
}
/**
* @private
*/
export class ItemTypeRef extends AbstractItemRef {
/**
* @param {decoding.Decoder} decoder