TypewriterPosition<T>

TYPE DEFINITION

When you loop over a Typewriter, using a for-of statement, you iterate over all positions in the Typewriters text. These positions are represented by a TypewriterPosition.

TypewriterPosition contains the character for that position, the position (index) of that character, and all cursors currently on the position. Lastly it will contain all cursors that have selected the position.

Since 1.2.0

Properties

  • character

    string

    The character which is at this position in the text.

    Since 1.2.0

  • cursors

    TypewriterCursor<T> []

    The cursors that are on this position.

    Since 1.2.0

  • position

    number

    The position of the 'character' in the text.

    IMPORTANT: in JavaScript some unicode characters have a length bigger than 1. For example "😃".length is 2 not 1.

    The Typewriter "normalizes" these so all unicode characters have a length of 1, by calling Array.from(text).

    Since 1.2.0

  • selected

    TypewriterCursor<T> []

    The cursors that have selected this position.

    Since 1.2.0