Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Question

Class represents a question.

Hierarchy

Index

Constructors

constructor

  • Parameters

    • goal: string

      A text to be eventually typed.

    • Optional opts: undefined | { keyComboChooser?: KeyComboChooser }

      An option object.

    Returns Question

Properties

Readonly goal

goal: string

A text to be eventually typed.

Accessors

keyCombos

keystrokes

  • get keystrokes(): string

parsedKeystrokes

pendingKeystrokes

  • get pendingKeystrokes(): string

resolvedKeystrokes

  • get resolvedKeystrokes(): string

resolvedText

  • get resolvedText(): string

text

  • get text(): string
  • The current interpretation of keystrokes in string form.

    Returns string

Methods

acceptsKeystrokes

  • acceptsKeystrokes(keystrokes: string): boolean
  • Returns a boolean that indicates whether the given keystrokes are acceptable.

    Parameters

    • keystrokes: string

      Keystrokes to test if acceptable.

    Returns boolean

    True if acceptable, and false if not.

getFirstKeyCombosFrom

  • Returns the first valid key combos to type the goal text.

    Parameters

    • Default value index: number = 0

      A zero-based index that indicates the position of text to start typing.

    Returns MSIMEKeyCombo[]

    The valid first key combos.

getKeyCombosSequence

  • Returns a sequence of key combos for entire goal text based on sequence chooser function.

    Parameters

    • index: number

      A zero-based index that indicates the position of text to start typing.

    • Default value keyComboChooser: (keyCombos: MSIMEKeyCombo[]) => MSIMEKeyCombo = this._keyComboChooser

      A key combo chooser function; uses the instance's default if not specified.

    Returns MSIMEKeyCombo[]

    A sequence of key combos for entire goal text.

getNextKeyCombos

  • Returns the first valid key combo to type the current position of goal text.

    Returns MSIMEKeyCombo[]

    The valid first key combos.

getNextPossibleKeyCombos

  • Returns the first possible key combo to type the current position of goal text.

    Returns MSIMEKeyCombo[]

    The possible first key combos taking the pending inputs into consideration.

getRestKeyCombosSequence

  • Returns a sequence of key combo from the current position to the end of goal text based on key combo chooser function.

    Parameters

    Returns MSIMEKeyCombo[]

    A sequence of key combos from the current position to the end of goal text based on key combo chooser function.

getRestText

  • getRestText(): string
  • Returns a part of the goal text that are not yet typed.

    Returns string

    The text that is not typed yet.

isSolved

  • isSolved(): boolean
  • Returns whether the supplied key inputs are interpreted to be the goal text.

    Returns boolean

    True if solved, and false if not.

supplyKeystrokes

  • Supply keystrokes as an answer. If the given keystrokes is invalid as an answer to the goal text, throws a RangeError.

    Parameters

    • keystrokes: string

      Keystrokes to supply.

    Returns ParsedKeystrokes

    Parsing result of the given keystrokes.

Generated using TypeDoc