Keyboard

keyboard~ Keyboard

The main class that orchestrates the interactive aspects of the keyboard.

Constructor

new Keyboard(user_id, first_load, emoji, prev_data)

Source:
Parameters:
Name Type Description
user_id number

The id of the current user. If no backend, then null.

first_load boolean

Whether it is the users first time. If no backend, then null.

emoji boolean

Whether to initialize the emoji version of the keyboard

prev_data Array | null

Prior calibration and preferences data for the user. If no backend, then null.

Methods

animate()

Description:
  • Repeatedly called on the interval defined in the config file. Triggers animation updates for the clock hands.

Source:

change_speed(index)

Description:
  • Changes the speed of clock rotation. Triggered by moving the speed slider.

Source:
Parameters:
Name Type Description
index number

The index (1-20) of the clock period list for the speed change.

continue_init()

Description:
  • Continues the construction process after the Promises from the language model have completed.

Source:

displayWindowSize()

Description:
  • Triggered by a window resize event. Recalculates all the sizes of the widgets for the new screen size.

Source:

draw_typed()

Source:

end_pause()

Description:
  • Ends the highlight of the KeyGrid following a selection after the timeout.

Source:

gen_word_prior(undo)

Description:
  • Formats the word and character probabilities from the language model for use in the inference module. If the user selected undo, the prior is initialized as uniform.

Source:
Parameters:
Name Type Description
undo boolean

Whether the previous round selected the undo option.

highlight_winner(clock_index)

Description:
  • Highlights the selected clock following a selection.

Source:
Parameters:
Name Type Description
clock_index number

The index of the selected clock.

init_ui()

Description:
  • Initializes the UI aspects (KeyGrid, ClockGrid, Clocks, Lables, Histogram, TextBox).

Source:

on_press()

Description:
  • Triggers the inference process after a switch press event.

Source:

on_word_load()

Description:
  • Triggers the process of redrawing the word clocks and labels after the Language Model updates.

Source:

play_audio()

Description:
  • Plays a bell sound when the user clicks their switch

Source:

start_pause()

Description:
  • Highlights the KeyGrid following a selection.

Source:

unhighlight_winner()

Description:
  • Ends the highlight of the previously selected clock after the timeout.

Source:

update_context()

Description:
  • Splits the currently typed text into left context and prefix for the language model. The prefix is the current word being typed, the left context is all the words before the current word.

Source: