docs: update jsdoc
This commit is contained in:
		
							parent
							
								
									02a9302f69
								
							
						
					
					
						commit
						7fe1b6a889
					
				@ -11,6 +11,16 @@ export const structGCRefNumber = 0
 | 
				
			|||||||
 * @private
 | 
					 * @private
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export class GC extends AbstractStruct {
 | 
					export class GC extends AbstractStruct {
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * @param {ID} id
 | 
				
			||||||
 | 
					   * @param {number} length
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  constructor (id, length) {
 | 
				
			||||||
 | 
					    super(id, length)
 | 
				
			||||||
 | 
					    this.left = null
 | 
				
			||||||
 | 
					    this.right = null
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  get deleted () {
 | 
					  get deleted () {
 | 
				
			||||||
    return true
 | 
					    return true
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -90,7 +90,7 @@ export class LazyStructReader {
 | 
				
			|||||||
  constructor (decoder, filterSkips) {
 | 
					  constructor (decoder, filterSkips) {
 | 
				
			||||||
    this.gen = lazyStructReaderGenerator(decoder)
 | 
					    this.gen = lazyStructReaderGenerator(decoder)
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @type {null | Item | Skip | GC}
 | 
					     * @type {null | Item | GC}
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    this.curr = null
 | 
					    this.curr = null
 | 
				
			||||||
    this.done = false
 | 
					    this.done = false
 | 
				
			||||||
@ -99,11 +99,12 @@ export class LazyStructReader {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * @return {Item | GC | Skip |null}
 | 
					   * @return {Item | GC |null}
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  next () {
 | 
					  next () {
 | 
				
			||||||
    // ignore "Skip" structs
 | 
					    // ignore "Skip" structs
 | 
				
			||||||
    do {
 | 
					    do {
 | 
				
			||||||
 | 
					      // @ts-ignore this.curr is not `Skip` finally
 | 
				
			||||||
      this.curr = this.gen.next().value || null
 | 
					      this.curr = this.gen.next().value || null
 | 
				
			||||||
    } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip)
 | 
					    } while (this.filterSkips && this.curr !== null && this.curr.constructor === Skip)
 | 
				
			||||||
    return this.curr
 | 
					    return this.curr
 | 
				
			||||||
@ -297,7 +298,7 @@ export const parseUpdateMeta = update => parseUpdateMetaV2(update, UpdateDecoder
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param {Item | GC | Skip} left
 | 
					 * @param {Item | GC | Skip} left
 | 
				
			||||||
 * @param {number} diff
 | 
					 * @param {number} diff
 | 
				
			||||||
 * @return {Item | GC}
 | 
					 * @return {Item | GC | Skip}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const sliceStruct = (left, diff) => {
 | 
					const sliceStruct = (left, diff) => {
 | 
				
			||||||
  if (left.constructor === GC) {
 | 
					  if (left.constructor === GC) {
 | 
				
			||||||
@ -378,10 +379,11 @@ export const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = U
 | 
				
			|||||||
    const currDecoder = lazyStructDecoders[0]
 | 
					    const currDecoder = lazyStructDecoders[0]
 | 
				
			||||||
    // write from currDecoder until the next operation is from another client or if filler-struct
 | 
					    // write from currDecoder until the next operation is from another client or if filler-struct
 | 
				
			||||||
    // then we need to reorder the decoders and find the next operation to write
 | 
					    // then we need to reorder the decoders and find the next operation to write
 | 
				
			||||||
 | 
					    /** @type {number} */
 | 
				
			||||||
    const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client
 | 
					    const firstClient = /** @type {Item | GC} */ (currDecoder.curr).id.client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (currWrite !== null) {
 | 
					    if (currWrite !== null) {
 | 
				
			||||||
      let curr = /** @type {Item | GC | null} */ (currDecoder.curr)
 | 
					      let curr = /** @type {Item | GC | Skip | null} */ (currDecoder.curr)
 | 
				
			||||||
      let iterated = false
 | 
					      let iterated = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // iterate until we find something that we haven't written already
 | 
					      // iterate until we find something that we haven't written already
 | 
				
			||||||
@ -520,7 +522,7 @@ const flushLazyStructWriter = lazyWriter => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @param {LazyStructWriter} lazyWriter
 | 
					 * @param {LazyStructWriter} lazyWriter
 | 
				
			||||||
 * @param {Item | GC} struct
 | 
					 * @param {Item | GC | Skip} struct
 | 
				
			||||||
 * @param {number} offset
 | 
					 * @param {number} offset
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const writeStructToLazyStructWriter = (lazyWriter, struct, offset) => {
 | 
					const writeStructToLazyStructWriter = (lazyWriter, struct, offset) => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user