Options
Menu

Class StringSpliceEvent

Emitted when a portion a RealTimeString we replaced.

See RealTimeString.splice

In this example, note the properties that get printed out in the event subscription:

model.emitLocalEvents(true);

let rtStr = model.elementAt('hello world');
console.log(rtStr.value()); // "hello world"

rtStr.events().subscribe(function(e) {
  console.log('event name:', e.name);
  console.log('event local:', e.local);
  console.log('splice index:', e.index);
  console.log('delete count:', e.deleteCount);
  console.log('inserted value:', e.insertValue);
});

rtStr.splice(6, 5, "everyone");
// event name: "splice"
// event local: true
// splice at index: 1
// delete count: 5
// inserted value: "everyone"

Hierarchy

  • StringSpliceEvent

Implements

Index

Properties

deleteCount

deleteCount: number

The the number of characters from the string that were removed, if any.

element

The RealTimeString or HistoricalString which was modified

index

index: number

The index at which the character(s) were removed

insertValue

insertValue: string

The value that was inserted into the string at the index, if any.

local

local: boolean

name

name: string = StringSpliceEvent.NAME

The name of the event that was fired. This is commonly used to filter when using the ConvergenceEventEmitter.events stream.

Note that the name is only guaranteed to be unique within the class / subsystem that is firing it. Names might be reused across classes and subsystems.

sessionId

sessionId: string

The sessionId corresponding to the session that performed the modification

user

The user which performed the modification

NAME

NAME: "splice" = "splice"