@y/y 14.0.0-16 → 14.0.0-17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-DyTeTfmj.js → index-BV-j5wdP.js} +2 -2
- package/dist/{index-R7GxO-36.js.map → index-BV-j5wdP.js.map} +1 -1
- package/dist/{internals.mjs → internals.js} +1 -1
- package/dist/internals.js.map +1 -0
- package/dist/{testHelper.mjs → testHelper.js} +2 -2
- package/dist/testHelper.js.map +1 -0
- package/dist/{yjs.mjs → yjs.js} +2 -2
- package/dist/yjs.js.map +1 -0
- package/package.json +8 -17
- package/dist/Skip-j0kX7pdq.js +0 -12173
- package/dist/Skip-j0kX7pdq.js.map +0 -1
- package/dist/index-DyTeTfmj.js.map +0 -1
- package/dist/index-R7GxO-36.js +0 -165
- package/dist/internals.cjs +0 -286
- package/dist/internals.cjs.map +0 -1
- package/dist/internals.mjs.map +0 -1
- package/dist/testHelper.cjs +0 -780
- package/dist/testHelper.cjs.map +0 -1
- package/dist/testHelper.mjs.map +0 -1
- package/dist/yjs.cjs +0 -151
- package/dist/yjs.cjs.map +0 -1
- package/dist/yjs.mjs.map +0 -1
- package/src/index.js +0 -153
- package/src/internals.js +0 -44
- package/src/structs/AbstractStruct.js +0 -59
- package/src/structs/ContentAny.js +0 -115
- package/src/structs/ContentBinary.js +0 -93
- package/src/structs/ContentDeleted.js +0 -101
- package/src/structs/ContentDoc.js +0 -141
- package/src/structs/ContentEmbed.js +0 -98
- package/src/structs/ContentFormat.js +0 -105
- package/src/structs/ContentJSON.js +0 -119
- package/src/structs/ContentString.js +0 -113
- package/src/structs/ContentType.js +0 -176
- package/src/structs/GC.js +0 -80
- package/src/structs/Item.js +0 -845
- package/src/structs/Skip.js +0 -75
- package/src/types/AbstractType.js +0 -1434
- package/src/types/YArray.js +0 -270
- package/src/types/YMap.js +0 -244
- package/src/types/YText.js +0 -934
- package/src/types/YXmlElement.js +0 -227
- package/src/types/YXmlFragment.js +0 -266
- package/src/types/YXmlHook.js +0 -68
- package/src/types/YXmlText.js +0 -66
- package/src/utils/AbstractConnector.js +0 -25
- package/src/utils/AttributionManager.js +0 -619
- package/src/utils/Doc.js +0 -372
- package/src/utils/EventHandler.js +0 -87
- package/src/utils/ID.js +0 -89
- package/src/utils/IdMap.js +0 -629
- package/src/utils/IdSet.js +0 -823
- package/src/utils/RelativePosition.js +0 -352
- package/src/utils/Snapshot.js +0 -220
- package/src/utils/StructSet.js +0 -137
- package/src/utils/StructStore.js +0 -289
- package/src/utils/Transaction.js +0 -489
- package/src/utils/UndoManager.js +0 -391
- package/src/utils/UpdateDecoder.js +0 -281
- package/src/utils/UpdateEncoder.js +0 -320
- package/src/utils/YEvent.js +0 -216
- package/src/utils/delta-helpers.js +0 -54
- package/src/utils/encoding.js +0 -623
- package/src/utils/isParentOf.js +0 -21
- package/src/utils/logging.js +0 -21
- package/src/utils/types.js +0 -28
- package/src/utils/updates.js +0 -715
- package/tests/testHelper.js +0 -600
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line
|
|
3
|
-
} from '../internals.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
export class ContentJSON {
|
|
9
|
-
/**
|
|
10
|
-
* @param {Array<any>} arr
|
|
11
|
-
*/
|
|
12
|
-
constructor (arr) {
|
|
13
|
-
/**
|
|
14
|
-
* @type {Array<any>}
|
|
15
|
-
*/
|
|
16
|
-
this.arr = arr
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @return {number}
|
|
21
|
-
*/
|
|
22
|
-
getLength () {
|
|
23
|
-
return this.arr.length
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @return {Array<any>}
|
|
28
|
-
*/
|
|
29
|
-
getContent () {
|
|
30
|
-
return this.arr
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @return {boolean}
|
|
35
|
-
*/
|
|
36
|
-
isCountable () {
|
|
37
|
-
return true
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @return {ContentJSON}
|
|
42
|
-
*/
|
|
43
|
-
copy () {
|
|
44
|
-
return new ContentJSON(this.arr)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param {number} offset
|
|
49
|
-
* @return {ContentJSON}
|
|
50
|
-
*/
|
|
51
|
-
splice (offset) {
|
|
52
|
-
const right = new ContentJSON(this.arr.slice(offset))
|
|
53
|
-
this.arr = this.arr.slice(0, offset)
|
|
54
|
-
return right
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @param {ContentJSON} right
|
|
59
|
-
* @return {boolean}
|
|
60
|
-
*/
|
|
61
|
-
mergeWith (right) {
|
|
62
|
-
this.arr = this.arr.concat(right.arr)
|
|
63
|
-
return true
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @param {Transaction} transaction
|
|
68
|
-
* @param {Item} item
|
|
69
|
-
*/
|
|
70
|
-
integrate (transaction, item) {}
|
|
71
|
-
/**
|
|
72
|
-
* @param {Transaction} transaction
|
|
73
|
-
*/
|
|
74
|
-
delete (transaction) {}
|
|
75
|
-
/**
|
|
76
|
-
* @param {Transaction} _tr
|
|
77
|
-
*/
|
|
78
|
-
gc (_tr) {}
|
|
79
|
-
/**
|
|
80
|
-
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
81
|
-
* @param {number} offset
|
|
82
|
-
* @param {number} offsetEnd
|
|
83
|
-
*/
|
|
84
|
-
write (encoder, offset, offsetEnd) {
|
|
85
|
-
const end = this.arr.length - offsetEnd
|
|
86
|
-
encoder.writeLen(end - offset)
|
|
87
|
-
for (let i = offset; i < end; i++) {
|
|
88
|
-
const c = this.arr[i]
|
|
89
|
-
encoder.writeString(c === undefined ? 'undefined' : JSON.stringify(c))
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @return {number}
|
|
95
|
-
*/
|
|
96
|
-
getRef () {
|
|
97
|
-
return 2
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @private
|
|
103
|
-
*
|
|
104
|
-
* @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
|
|
105
|
-
* @return {ContentJSON}
|
|
106
|
-
*/
|
|
107
|
-
export const readContentJSON = decoder => {
|
|
108
|
-
const len = decoder.readLen()
|
|
109
|
-
const cs = []
|
|
110
|
-
for (let i = 0; i < len; i++) {
|
|
111
|
-
const c = decoder.readString()
|
|
112
|
-
if (c === 'undefined') {
|
|
113
|
-
cs.push(undefined)
|
|
114
|
-
} else {
|
|
115
|
-
cs.push(JSON.parse(c))
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return new ContentJSON(cs)
|
|
119
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item, StructStore // eslint-disable-line
|
|
3
|
-
} from '../internals.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
export class ContentString {
|
|
9
|
-
/**
|
|
10
|
-
* @param {string} str
|
|
11
|
-
*/
|
|
12
|
-
constructor (str) {
|
|
13
|
-
/**
|
|
14
|
-
* @type {string}
|
|
15
|
-
*/
|
|
16
|
-
this.str = str
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @return {number}
|
|
21
|
-
*/
|
|
22
|
-
getLength () {
|
|
23
|
-
return this.str.length
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @return {Array<any>}
|
|
28
|
-
*/
|
|
29
|
-
getContent () {
|
|
30
|
-
return this.str.split('')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @return {boolean}
|
|
35
|
-
*/
|
|
36
|
-
isCountable () {
|
|
37
|
-
return true
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @return {ContentString}
|
|
42
|
-
*/
|
|
43
|
-
copy () {
|
|
44
|
-
return new ContentString(this.str)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param {number} offset
|
|
49
|
-
* @return {ContentString}
|
|
50
|
-
*/
|
|
51
|
-
splice (offset) {
|
|
52
|
-
const right = new ContentString(this.str.slice(offset))
|
|
53
|
-
this.str = this.str.slice(0, offset)
|
|
54
|
-
|
|
55
|
-
// Prevent encoding invalid documents because of splitting of surrogate pairs: https://github.com/yjs/yjs/issues/248
|
|
56
|
-
const firstCharCode = this.str.charCodeAt(offset - 1)
|
|
57
|
-
if (firstCharCode >= 0xD800 && firstCharCode <= 0xDBFF) {
|
|
58
|
-
// Last character of the left split is the start of a surrogate utf16/ucs2 pair.
|
|
59
|
-
// We don't support splitting of surrogate pairs because this may lead to invalid documents.
|
|
60
|
-
// Replace the invalid character with a unicode replacement character (� / U+FFFD)
|
|
61
|
-
this.str = this.str.slice(0, offset - 1) + '�'
|
|
62
|
-
// replace right as well
|
|
63
|
-
right.str = '�' + right.str.slice(1)
|
|
64
|
-
}
|
|
65
|
-
return right
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @param {ContentString} right
|
|
70
|
-
* @return {boolean}
|
|
71
|
-
*/
|
|
72
|
-
mergeWith (right) {
|
|
73
|
-
this.str += right.str
|
|
74
|
-
return true
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @param {Transaction} transaction
|
|
79
|
-
* @param {Item} item
|
|
80
|
-
*/
|
|
81
|
-
integrate (transaction, item) {}
|
|
82
|
-
/**
|
|
83
|
-
* @param {Transaction} transaction
|
|
84
|
-
*/
|
|
85
|
-
delete (transaction) {}
|
|
86
|
-
/**
|
|
87
|
-
* @param {Transaction} _tr
|
|
88
|
-
*/
|
|
89
|
-
gc (_tr) {}
|
|
90
|
-
/**
|
|
91
|
-
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
92
|
-
* @param {number} offset
|
|
93
|
-
* @param {number} offsetEnd
|
|
94
|
-
*/
|
|
95
|
-
write (encoder, offset, offsetEnd) {
|
|
96
|
-
encoder.writeString((offset === 0 && offsetEnd === 0) ? this.str : this.str.slice(offset, this.str.length - offsetEnd))
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @return {number}
|
|
101
|
-
*/
|
|
102
|
-
getRef () {
|
|
103
|
-
return 4
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @private
|
|
109
|
-
*
|
|
110
|
-
* @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
|
|
111
|
-
* @return {ContentString}
|
|
112
|
-
*/
|
|
113
|
-
export const readContentString = decoder => new ContentString(decoder.readString())
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readYArray,
|
|
3
|
-
readYMap,
|
|
4
|
-
readYText,
|
|
5
|
-
readYXmlElement,
|
|
6
|
-
readYXmlFragment,
|
|
7
|
-
readYXmlHook,
|
|
8
|
-
readYXmlText,
|
|
9
|
-
UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Transaction, Item // eslint-disable-line
|
|
10
|
-
} from '../internals.js'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {import('../utils/types.js').YType} YType_CT
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import * as error from 'lib0/error'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @type {Array<(decoder: UpdateDecoderV1 | UpdateDecoderV2)=>(import('../utils/types.js').YType)>}
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
export const typeRefs = [
|
|
23
|
-
readYArray,
|
|
24
|
-
readYMap,
|
|
25
|
-
readYText,
|
|
26
|
-
readYXmlElement,
|
|
27
|
-
readYXmlFragment,
|
|
28
|
-
readYXmlHook,
|
|
29
|
-
readYXmlText
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
export const YArrayRefID = 0
|
|
33
|
-
export const YMapRefID = 1
|
|
34
|
-
export const YTextRefID = 2
|
|
35
|
-
export const YXmlElementRefID = 3
|
|
36
|
-
export const YXmlFragmentRefID = 4
|
|
37
|
-
export const YXmlHookRefID = 5
|
|
38
|
-
export const YXmlTextRefID = 6
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @private
|
|
42
|
-
*/
|
|
43
|
-
export class ContentType {
|
|
44
|
-
/**
|
|
45
|
-
* @param {YType_CT} type
|
|
46
|
-
*/
|
|
47
|
-
constructor (type) {
|
|
48
|
-
/**
|
|
49
|
-
* @type {YType_CT}
|
|
50
|
-
*/
|
|
51
|
-
this.type = type
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @return {number}
|
|
56
|
-
*/
|
|
57
|
-
getLength () {
|
|
58
|
-
return 1
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @return {Array<any>}
|
|
63
|
-
*/
|
|
64
|
-
getContent () {
|
|
65
|
-
return [this.type]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @return {boolean}
|
|
70
|
-
*/
|
|
71
|
-
isCountable () {
|
|
72
|
-
return true
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @return {ContentType}
|
|
77
|
-
*/
|
|
78
|
-
copy () {
|
|
79
|
-
return new ContentType(this.type._copy())
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @param {number} _offset
|
|
84
|
-
* @return {ContentType}
|
|
85
|
-
*/
|
|
86
|
-
splice (_offset) {
|
|
87
|
-
throw error.methodUnimplemented()
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @param {ContentType} _right
|
|
92
|
-
* @return {boolean}
|
|
93
|
-
*/
|
|
94
|
-
mergeWith (_right) {
|
|
95
|
-
return false
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @param {Transaction} transaction
|
|
100
|
-
* @param {Item} item
|
|
101
|
-
*/
|
|
102
|
-
integrate (transaction, item) {
|
|
103
|
-
this.type._integrate(transaction.doc, item)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @param {Transaction} transaction
|
|
108
|
-
*/
|
|
109
|
-
delete (transaction) {
|
|
110
|
-
let item = this.type._start
|
|
111
|
-
while (item !== null) {
|
|
112
|
-
if (!item.deleted) {
|
|
113
|
-
item.delete(transaction)
|
|
114
|
-
} else if (!transaction.insertSet.hasId(item.id)) {
|
|
115
|
-
// This will be gc'd later and we want to merge it if possible
|
|
116
|
-
// We try to merge all deleted items after each transaction,
|
|
117
|
-
// but we have no knowledge about that this needs to be merged
|
|
118
|
-
// since it is not in transaction.ds. Hence we add it to transaction._mergeStructs
|
|
119
|
-
transaction._mergeStructs.push(item)
|
|
120
|
-
}
|
|
121
|
-
item = item.right
|
|
122
|
-
}
|
|
123
|
-
this.type._map.forEach(item => {
|
|
124
|
-
if (!item.deleted) {
|
|
125
|
-
item.delete(transaction)
|
|
126
|
-
} else if (!transaction.insertSet.hasId(item.id)) {
|
|
127
|
-
// same as above
|
|
128
|
-
transaction._mergeStructs.push(item)
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
transaction.changed.delete(this.type)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @param {Transaction} tr
|
|
136
|
-
*/
|
|
137
|
-
gc (tr) {
|
|
138
|
-
let item = this.type._start
|
|
139
|
-
while (item !== null) {
|
|
140
|
-
item.gc(tr, true)
|
|
141
|
-
item = item.right
|
|
142
|
-
}
|
|
143
|
-
this.type._start = null
|
|
144
|
-
this.type._map.forEach(/** @param {Item | null} item */ (item) => {
|
|
145
|
-
while (item !== null) {
|
|
146
|
-
item.gc(tr, true)
|
|
147
|
-
item = item.left
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
this.type._map = new Map()
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
155
|
-
* @param {number} _offset
|
|
156
|
-
* @param {number} _offsetEnd
|
|
157
|
-
*/
|
|
158
|
-
write (encoder, _offset, _offsetEnd) {
|
|
159
|
-
this.type._write(encoder)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @return {number}
|
|
164
|
-
*/
|
|
165
|
-
getRef () {
|
|
166
|
-
return 7
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @private
|
|
172
|
-
*
|
|
173
|
-
* @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
|
|
174
|
-
* @return {ContentType}
|
|
175
|
-
*/
|
|
176
|
-
export const readContentType = decoder => new ContentType(typeRefs[decoder.readTypeRef()](decoder))
|
package/src/structs/GC.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AbstractStruct,
|
|
3
|
-
addStruct,
|
|
4
|
-
addStructToIdSet,
|
|
5
|
-
addToIdSet,
|
|
6
|
-
createID,
|
|
7
|
-
UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction // eslint-disable-line
|
|
8
|
-
} from '../internals.js'
|
|
9
|
-
|
|
10
|
-
export const structGCRefNumber = 0
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
export class GC extends AbstractStruct {
|
|
16
|
-
get deleted () {
|
|
17
|
-
return true
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
delete () {}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @param {GC} right
|
|
24
|
-
* @return {boolean}
|
|
25
|
-
*/
|
|
26
|
-
mergeWith (right) {
|
|
27
|
-
if (this.constructor !== right.constructor) {
|
|
28
|
-
return false
|
|
29
|
-
}
|
|
30
|
-
this.length += right.length
|
|
31
|
-
return true
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @param {Transaction} transaction
|
|
36
|
-
* @param {number} offset - @todo remove offset parameter
|
|
37
|
-
*/
|
|
38
|
-
integrate (transaction, offset) {
|
|
39
|
-
if (offset > 0) {
|
|
40
|
-
this.id.clock += offset
|
|
41
|
-
this.length -= offset
|
|
42
|
-
}
|
|
43
|
-
addToIdSet(transaction.deleteSet, this.id.client, this.id.clock, this.length)
|
|
44
|
-
addStructToIdSet(transaction.insertSet, this)
|
|
45
|
-
addStruct(transaction.doc.store, this)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
50
|
-
* @param {number} offset
|
|
51
|
-
* @param {number} offsetEnd
|
|
52
|
-
*/
|
|
53
|
-
write (encoder, offset, offsetEnd) {
|
|
54
|
-
encoder.writeInfo(structGCRefNumber)
|
|
55
|
-
encoder.writeLen(this.length - offset - offsetEnd)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @param {Transaction} _transaction
|
|
60
|
-
* @param {StructStore} _store
|
|
61
|
-
* @return {null | number}
|
|
62
|
-
*/
|
|
63
|
-
getMissing (_transaction, _store) {
|
|
64
|
-
return null
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* gc structs can't be spliced.
|
|
69
|
-
*
|
|
70
|
-
* If this feature is required in the future, then need to try to merge this struct after
|
|
71
|
-
* transaction.
|
|
72
|
-
*
|
|
73
|
-
* @param {number} diff
|
|
74
|
-
*/
|
|
75
|
-
splice (diff) {
|
|
76
|
-
const other = new GC(createID(this.id.client, this.id.clock + diff), this.length - diff)
|
|
77
|
-
this.length = diff
|
|
78
|
-
return other
|
|
79
|
-
}
|
|
80
|
-
}
|