Files
yjs/src/structs/AbstractStruct.js

52 lines
1.1 KiB
JavaScript
Raw Normal View History

import {
2020-12-29 16:59:27 +01:00
UpdateEncoderV1, UpdateEncoderV2, ID, Transaction // eslint-disable-line
} from '../internals.js'
2021-05-14 18:53:24 +02:00
import * as error from 'lib0/error'
2019-03-26 01:14:15 +01:00
export class AbstractStruct {
/**
* @param {ID} id
* @param {number} length
2019-03-26 01:14:15 +01:00
*/
constructor (id, length) {
2019-03-26 01:14:15 +01:00
this.id = id
this.length = length
}
/**
* @type {boolean}
*/
get deleted () {
throw error.methodUnimplemented()
2019-03-26 01:14:15 +01:00
}
2020-01-22 16:42:16 +01:00
2019-04-03 02:30:44 +02:00
/**
* Merge this struct with the item to the right.
* This method is already assuming that `this.id.clock + this.length === this.id.clock`.
* Also this method does *not* remove right from StructStore!
* @param {AbstractStruct} right
2025-01-03 18:11:43 +00:00
* @return {boolean} whether this merged with right
2019-04-03 02:30:44 +02:00
*/
mergeWith (right) {
return false
}
2020-01-22 16:42:16 +01:00
2019-03-29 01:02:44 +01:00
/**
2020-12-29 16:59:27 +01:00
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
* @param {number} offset
2019-03-29 01:02:44 +01:00
* @param {number} encodingRef
*/
write (encoder, offset, encodingRef) {
throw error.methodUnimplemented()
}
2020-01-22 16:42:16 +01:00
/**
* @param {Transaction} transaction
* @param {number} offset
2019-03-26 01:14:15 +01:00
*/
integrate (transaction, offset) {
2019-03-29 01:02:44 +01:00
throw error.methodUnimplemented()
}
2019-03-26 01:14:15 +01:00
}