add relevant relative positions exports
This commit is contained in:
parent
7cbf204143
commit
baca852733
@ -63,6 +63,9 @@ export {
|
|||||||
encodeSnapshotV2,
|
encodeSnapshotV2,
|
||||||
decodeStateVector,
|
decodeStateVector,
|
||||||
decodeStateVectorV2,
|
decodeStateVectorV2,
|
||||||
|
encodeRelativePosition,
|
||||||
|
decodeRelativePosition,
|
||||||
|
relativePositionToJSON,
|
||||||
isDeleted,
|
isDeleted,
|
||||||
isParentOf,
|
isParentOf,
|
||||||
equalSnapshots,
|
equalSnapshots,
|
||||||
|
@ -75,13 +75,34 @@ export class RelativePosition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {RelativePosition} rpos
|
||||||
|
* @return {any}
|
||||||
|
*/
|
||||||
|
export const relativePositionToJSON = rpos => {
|
||||||
|
const json = {}
|
||||||
|
if (rpos.type) {
|
||||||
|
json.type = rpos.type
|
||||||
|
}
|
||||||
|
if (rpos.tname) {
|
||||||
|
json.tname = rpos.tname
|
||||||
|
}
|
||||||
|
if (rpos.item) {
|
||||||
|
json.item = rpos.item
|
||||||
|
}
|
||||||
|
if (rpos.assoc != null) {
|
||||||
|
json.assoc = rpos.assoc
|
||||||
|
}
|
||||||
|
return json
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {any} json
|
* @param {any} json
|
||||||
* @return {RelativePosition}
|
* @return {RelativePosition}
|
||||||
*
|
*
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
export const createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname || null, json.item == null ? null : createID(json.item.client, json.item.clock))
|
export const createRelativePositionFromJSON = json => new RelativePosition(json.type == null ? null : createID(json.type.client, json.type.clock), json.tname || null, json.item == null ? null : createID(json.item.client, json.item.clock), json.assoc == null ? 0 : json.assoc)
|
||||||
|
|
||||||
export class AbsolutePosition {
|
export class AbsolutePosition {
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user