TypewriterCursor<T>

CLASS

Represents a cursor within a Typewriter.

Note: when initialize is called on a Typewriter all cursors are reset, and the previously attached cursors become detached, this means that the positions of the cursors are no longer accurate.

You should never instantiate a TypewriterCursor directly. It should always be given to you by the Typewriter.

Since 1.2.0

Constructor

Creates an TypewriterCursor which belongs to the given Typewriter.

Note: you should never create instances of TypewriterCursor yourself. You are supposed to let the Typewriter do this for you.

Since 1.2.0

Signature

constructor(
typewriter : Typewriter<T> ,
position : number ,
data : T ,
): TypewriterCursor<T>

Parameters

typewriter: Typewriter<T>

The Typewriter this TypewriterCursor belongs to.

position: number

The position of this TypewriterCursor within the Typewriter text.

data: T

The data for this TypewriterCursor

selection: TypewriterCursorSelection

The selection of the TypewriterCursor

Properties

  • isBlinking

    boolean

    Whether or not this cursor is blinking.

    A cursor does not blink when the user is typing, only when the user has stopped typing then after a little while the cursor will start blinking again.

    The time until the cursors blinks again is the Typewriter's blinkAfter property.

    Since 1.2.0

  • position

    number

    The position of the cursor within the Typewriter text.

    If the cursor also has a selection, the position will always either on the start or end of the selection.

    Note: when initialize is called on a Typewriter all cursors become detached, and the position is no longer accurate.

    Since 1.2.0

  • selection

    TypewriterCursorSelection

    The range of positions which this cursor has selected, or when it is undefined signifying no selection.

    The position of a cursors is always either on the start or end of the selection.

    Note: whenever the cursor stops selecting text the selection will be turned into undefined. So be careful not to keep any references to selections.

    Since 1.2.0