Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Document

Exists only for backwards compatability.

deprecated

Will be removed in next minor version bump. Semver allows this when the major version is 0.

todo

Remove this class. Create an event bus system.

Hierarchy

  • Document

Index

Constructors

constructor

  • new Document(send: function, insertLocal: function, removeLocal: function): Document
  • Parameters

    • send: function

      A callback function to send a LogootEvent

    • insertLocal: function

      A callback function to insert text

        • (position: number, body: string): void
        • Parameters

          • position: number
          • body: string

          Returns void

    • removeLocal: function

      A callback function to remove text

        • (position: number, length: number): void
        • Parameters

          • position: number
          • length: number

          Returns void

    Returns Document

Properties

_active_listeners

_active_listeners: any[] = []

Used to keep track of active EventEmitter listeners having anything to do with this document

deprecated

it shouldn't be here and is temporary

todo

Move this to matrix-notepad

doc

doc: ListDocumentModel = new ListDocumentModel()

Private insertLocal

insertLocal: function

Type declaration

    • (position: number, body: string): void
    • Parameters

      • position: number
      • body: string

      Returns void

last_insertion_event

last_insertion_event: InsertionEvent = undefined

pending_events

pending_events: LogootEvent[] = []

Events that need to get sent over Matrix

Private removeLocal

removeLocal: function

Type declaration

    • (position: number, length: number): void
    • Parameters

      • position: number
      • length: number

      Returns void

Private send

send: function

Type declaration

Accessors

ldoc_bst

logoot_bst

removal_bst

Methods

Private _pushEvent

Private _removePendingEvent

Private _tryMergeEvents

insert

  • insert(position: number, text: string): void
  • Inform the document of new text in the local text copy. This will call the send function with the resulting event.

    Parameters

    • position: number

      The index of new text

    • text: string

      The text that will be inserted

    Returns void

remoteInsert

  • remoteInsert(event_contents: JSON): void
  • Inform the document of an incoming event from remote documents. The function insertLocal will be called based on the results of this.

    Parameters

    • event_contents: JSON

      The raw incoming JSON

    Returns void

remoteRemove

  • remoteRemove(event_contents: JSON): void
  • Inform the document of an incoming event from remote documents. The function removeLocal will be called based on the results of this.

    Parameters

    • event_contents: JSON

      The raw incoming JSON

    Returns void

remove

  • remove(position: number, length: number): void
  • Inform the document of removed text in the local text copy. This will call the send function with the resulting event.

    Parameters

    • position: number

      The index of old text

    • length: number

      The length text that will be removed

    Returns void

Generated using TypeDoc