Global

Members

constant addChangedTypeToTransaction

If type.parent was added in current transaction, type technically did not change, it was just added and we should not fire events for type.

constant callTypeObservers

Call event listeners with an event. This will also add an event to all parents (for .observeDeep handlers).

constant contentRefs :Array.<function(AbstractUpdateDecoder): AbstractContent>

A lookup map for reading Item content.

constant createDocFromSnapshot

constant createSnapshot

constant decodeRelativePosition

constant decodeSnapshot

constant decodeSnapshotV2

constant encodeRelativePosition

constant encodeSnapshot

constant encodeSnapshotV2

constant equalSnapshots

constant findIndexCleanStart

constant findMarker

Search marker help us to find positions in the associative array faster.

They speed up the process of finding a position without much bookkeeping.

A maximum of maxSearchMarker objects are created.

This function always returns a refreshed marker (updated timestamp)

constant followRedone

To Do:
  • This should return several items

constant getTypeChildren

Accumulate all (list) children of a type and return them as an Array.

globalSearchMarkerTimestamp :number

A unique timestamp that identifies each marker.

Time is relative,.. this is more like an ever-increasing clock.

constant keepItem

Make sure that neither item nor any of its parents is ever deleted.

This property does not persist when storing it into a database or when sending it to other peers

constant logType

Convenient helper to log type information.

Do not use in productive systems as the output can be immense!

constant mergeDeleteSets

constant readContentAny

constant readContentBinary

constant readContentFormat

constant readItemContent

constant snapshot

constant splitSnapshotAffectedStructs

constant tryGc

constant updateMarkerChanges

Update markers when a change happened.

This should be called before doing a deletion!

constant writeUpdateMessageFromTransaction

Methods

cleanupTransactions(transactionCleanups, i)

Parameters:
Name Type Description
transactionCleanups Array.<Transaction>
i number

compareIDs(a, b) → {boolean}

Parameters:
Name Type Description
a ID | null
b ID | null
Returns:
boolean

compareRelativePositions(a, b)

Parameters:
Name Type Description
a RelativePosition | null
b RelativePosition | null

createAbsolutePosition(type, index)

Parameters:
Name Type Description
type AbstractType.<any>
index number

createAbsolutePositionFromRelativePosition(rpos, doc) → {AbsolutePosition|null}

Parameters:
Name Type Description
rpos RelativePosition
doc Doc
Returns:
AbsolutePosition | null

createRelativePosition(type, item)

Parameters:
Name Type Description
type AbstractType.<any>
item ID | null

createRelativePositionFromJSON(json) → {RelativePosition}

Parameters:
Name Type Description
json any
Returns:
RelativePosition

createRelativePositionFromTypeIndex(type, index) → {RelativePosition}

Create a relativePosition based on a absolute position.

Parameters:
Name Type Description
type AbstractType.<any>

The base type (e.g. YText or YArray).

index number

The absolute position.

Returns:
RelativePosition

getState(store, client) → {number}

Parameters:
Name Type Description
store StructStore
client number
Returns:
number

getStateVector(store) → {Map.<number, number>}

Return the states as a Map<client,clock>. Note that clock refers to the next expected clock id.

Parameters:
Name Type Description
store StructStore
Returns:
Map.<number, number>

protected isVisible(item, snapshot)

Parameters:
Name Type Description
item Item
snapshot Snapshot | undefined

iterateDeletedStructs(transaction, ds)

Iterate over all structs that the DeleteSet gc's.

Parameters:
Name Type Description
transaction Transaction
ds DeleteSet

iterateStructs(transaction, structs, clockStart, len)

Iterate over a range of structs

Parameters:
Name Type Description
transaction Transaction
structs Array.<(Item|GC)>
clockStart number

Inclusive start

len number

markPosition(searchMarker, p, index)

Parameters:
Name Type Description
searchMarker Array.<ArraySearchMarker>
p Item
index number

overwriteMarker(marker, p, index)

This is rather complex so this function is the only thing that should overwrite a marker

Parameters:
Name Type Description
marker ArraySearchMarker
p Item
index number

popStackItem(undoManager, stack, eventType) → nullable {StackItem}

Parameters:
Name Type Description
undoManager UndoManager
stack Array.<StackItem>
eventType string
Returns:
StackItem

readRelativePosition(decoder) → {RelativePosition|null}

Parameters:
Name Type Description
decoder decoding.Decoder
Returns:
RelativePosition | null

readYXmlElement(decoder) → {YXmlElement}

Parameters:
Name Type Description
decoder AbstractUpdateDecoder
Returns:
YXmlElement

refreshMarkerTimestamp(marker)

Parameters:
Name Type Description
marker ArraySearchMarker

transact(doc, f, originopt)

Implements the functionality of y.transact(()=>{..})

Parameters:
Name Type Attributes Default Description
doc Doc
f function
origin any <optional>
true

tryGcDeleteSet(ds, store, gcFilter)

Parameters:
Name Type Description
ds DeleteSet
store StructStore
gcFilter function

tryMergeDeleteSet(ds, store)

Parameters:
Name Type Description
ds DeleteSet
store StructStore

tryToMergeWithLeft(structs, pos)

Parameters:
Name Type Description
structs Array.<AbstractStruct>
pos number

writeRelativePosition(encoder, rpos)

Parameters:
Name Type Description
encoder encoding.Encoder
rpos RelativePosition

Type Definitions

UndoManagerOptions

Properties:
Name Type Attributes Default Description
UndoManagerOptions.captureTimeout number <optional>
500
UndoManagerOptions.deleteFilter function <optional>
()=>true

Sometimes it is necessary to filter whan an Undo/Redo operation can delete. If this filter returns false, the type/item won't be deleted even it is in the undo/redo scope.

UndoManagerOptions.trackedOrigins Set.<any> <optional>
new Set([null])