mirror of
https://github.com/yjs/yjs.git
synced 2026-02-24 12:10:16 +01:00
prelim refactor commit
This commit is contained in:
38
src/structs/AbstractStruct.js
Normal file
38
src/structs/AbstractStruct.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Y } from '../utils/Y.js' // eslint-disable-line
|
||||
import { ID } from '../utils/ID.js' // eslint-disable-line
|
||||
import { Transaction } from '../utils/Transaction.js' // eslint-disable-line
|
||||
|
||||
// eslint-disable-next-line
|
||||
export class AbstractStruct {
|
||||
/**
|
||||
* @param {ID} id
|
||||
*/
|
||||
constructor (id) {
|
||||
/**
|
||||
* The uniqe identifier of this struct.
|
||||
* @type {ID}
|
||||
* @readonly
|
||||
*/
|
||||
this.id = id
|
||||
}
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
get length () {
|
||||
throw new Error('unimplemented')
|
||||
}
|
||||
}
|
||||
|
||||
export class AbstractRef {
|
||||
/**
|
||||
* @return {Array<ID|null>}
|
||||
*/
|
||||
getMissing () {
|
||||
return []
|
||||
}
|
||||
/**
|
||||
* @param {Transaction} transaction
|
||||
* @return {AbstractStruct}
|
||||
*/
|
||||
toStruct (transaction) { throw new Error('Must be defined') }
|
||||
}
|
||||
Reference in New Issue
Block a user