Skip to main content
Version: v1

IntervalCollection Class

Signature

export declare class IntervalCollection<TInterval extends ISerializableInterval> extends TypedEventEmitter<IIntervalCollectionEvent<TInterval>>

Extends: TypedEventEmitter<IIntervalCollectionEvent

Type Parameters

ParameterConstraintDescription
TIntervalISerializableInterval

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the IntervalCollection class.

Properties

PropertyTypeDescription
attachedboolean

Methods

MethodAlertsReturn TypeDescription
[Symbol.iterator]()IntervalCollectionIterator<TInterval>
add(start, end, intervalType, props)TIntervalCreate a new interval and add it to the collection
addConflictResolver(conflictResolver)void
addInternal(serializedInterval, local, op)DeprecatedTInterval
attachDeserializer(onDeserialize)void
attachGraph(client, label)void
change(id, start, end)TInterval | undefined
changeInterval(serializedInterval, local, op)Deprecatedvoid
changeProperties(id, props)void
CreateBackwardIteratorWithEndPosition(endPosition)IntervalCollectionIterator<TInterval>
CreateBackwardIteratorWithStartPosition(startPosition)IntervalCollectionIterator<TInterval>
CreateForwardIteratorWithEndPosition(endPosition)IntervalCollectionIterator<TInterval>
CreateForwardIteratorWithStartPosition(startPosition)IntervalCollectionIterator<TInterval>
deleteInterval(serializedInterval, local, op)Deprecatedvoid
findOverlappingIntervals(startPosition, endPosition)TInterval[]
gatherIterationResults(results, iteratesForward, start, end)void
getIntervalById(id)TInterval
map(fn)void
nextInterval(pos)TInterval
previousInterval(pos)TInterval
removeIntervalById(id)TInterval

Property Details

attached

Signature

get attached(): boolean;

Type: boolean

Method Details

[Symbol.iterator]

Signature

[Symbol.iterator](): IntervalCollectionIterator<TInterval>;

Returns

Return type: IntervalCollectionIterator<TInterval>

add

Create a new interval and add it to the collection

Signature

add(start: number, end: number, intervalType: IntervalType, props?: PropertySet): TInterval;

Parameters

ParameterModifiersTypeDescription
startnumberinterval start position
endnumberinterval end position
intervalTypeIntervalTypetype of the interval. All intervals are SlideOnRemove. Intervals may not be Transient.
propsoptionalPropertySetproperties of the interval

Returns

  • the created interval

Return type: TInterval

addConflictResolver

Signature

addConflictResolver(conflictResolver: IntervalConflictResolver<TInterval>): void;

Parameters

ParameterTypeDescription
conflictResolverIntervalConflictResolver<TInterval>

addInternal

This API is deprecated and will be removed in a future release.
  • use ackAdd

Signature

addInternal(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage): TInterval;

Parameters

ParameterTypeDescription
serializedIntervalISerializedInterval
localboolean
opISequencedDocumentMessage

Returns

Return type: TInterval

attachDeserializer

Signature

attachDeserializer(onDeserialize: DeserializeCallback): void;

Parameters

ParameterTypeDescription
onDeserializeDeserializeCallback

attachGraph

Signature

attachGraph(client: Client, label: string): void;

Parameters

ParameterTypeDescription
clientClient
labelstring

change

Signature

change(id: string, start?: number, end?: number): TInterval | undefined;

Parameters

ParameterModifiersTypeDescription
idstring
startoptionalnumber
endoptionalnumber

Returns

Return type: TInterval | undefined

changeInterval

This API is deprecated and will be removed in a future release.
  • use ackChange

Signature

changeInterval(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage): void;

Parameters

ParameterTypeDescription
serializedIntervalISerializedInterval
localboolean
opISequencedDocumentMessage

changeProperties

Signature

changeProperties(id: string, props: PropertySet): void;

Parameters

ParameterTypeDescription
idstring
propsPropertySet

CreateBackwardIteratorWithEndPosition

Signature

CreateBackwardIteratorWithEndPosition(endPosition: number): IntervalCollectionIterator<TInterval>;

Parameters

ParameterTypeDescription
endPositionnumber

Returns

Return type: IntervalCollectionIterator<TInterval>

CreateBackwardIteratorWithStartPosition

Signature

CreateBackwardIteratorWithStartPosition(startPosition: number): IntervalCollectionIterator<TInterval>;

Parameters

ParameterTypeDescription
startPositionnumber

Returns

Return type: IntervalCollectionIterator<TInterval>

CreateForwardIteratorWithEndPosition

Signature

CreateForwardIteratorWithEndPosition(endPosition: number): IntervalCollectionIterator<TInterval>;

Parameters

ParameterTypeDescription
endPositionnumber

Returns

Return type: IntervalCollectionIterator<TInterval>

CreateForwardIteratorWithStartPosition

Signature

CreateForwardIteratorWithStartPosition(startPosition: number): IntervalCollectionIterator<TInterval>;

Parameters

ParameterTypeDescription
startPositionnumber

Returns

Return type: IntervalCollectionIterator<TInterval>

deleteInterval

This API is deprecated and will be removed in a future release.
  • use ackDelete

Signature

deleteInterval(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage): void;

Parameters

ParameterTypeDescription
serializedIntervalISerializedInterval
localboolean
opISequencedDocumentMessage

findOverlappingIntervals

Signature

findOverlappingIntervals(startPosition: number, endPosition: number): TInterval[];

Parameters

ParameterTypeDescription
startPositionnumber
endPositionnumber

Returns

Return type: TInterval[]

gatherIterationResults

Signature

gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: number, end?: number): void;

Parameters

ParameterModifiersTypeDescription
resultsTInterval[]
iteratesForwardboolean
startoptionalnumber
endoptionalnumber

getIntervalById

Signature

getIntervalById(id: string): TInterval;

Parameters

ParameterTypeDescription
idstring

Returns

Return type: TInterval

map

Signature

map(fn: (interval: TInterval) => void): void;

Parameters

ParameterTypeDescription
fn(interval: TInterval) => void

nextInterval

Signature

nextInterval(pos: number): TInterval;

Parameters

ParameterTypeDescription
posnumber

Returns

Return type: TInterval

previousInterval

Signature

previousInterval(pos: number): TInterval;

Parameters

ParameterTypeDescription
posnumber

Returns

Return type: TInterval

removeIntervalById

Signature

removeIntervalById(id: string): TInterval;

Parameters

ParameterTypeDescription
idstring

Returns

Return type: TInterval