Class: Target

modules/Target.Target()

Manages the randomized target and interacts and interacts with DOM elements related to it.

Constructor

new Target()

Source:
See:
  • Communicator

Extends

  • Communicator

Members

clickIntervals :number

The average of the session click intervals in milliseconds

Type:
  • number
Source:

clickTimes :Array.<Timer:Timestamp>

A first-in, first-out queue of session click times. The queue has a maximum length of 2.

Type:
  • Array.<Timer:Timestamp>
Source:

defaults

Contains default target DOM element configuration.

Properties:
Name Type Description
left number

The left position.

top number

The top position.

side number

The width and height dimension.

visibility string

The visibility.

Source:

domElements :Object.<string, HTMLElement>

Type:
  • Object.<string, HTMLElement>
Properties:
Name Type Description
target HTMLDivElement

Can be clicked to score points.

targetVisibility HTMLInputElement

Can be clicked to enable or disable the target.

averageClick HTMLAnchorElement

Displays the average time, in milliseconds, that a target click was accepted following the target was displayed.

start HTMLAnchorElement

Can be clicked to reset the target position and dimensions.

end HTMLAnchorElement

Can be clicked to reset the target position and dimensions, and the average click time.

Source:

pointsValue :number

The points a target click is worth. This value is multiplied by the timescale multiplier when points are scored.

Type:
  • number
Source:

targetElementVisibility :boolean

Gets the target DOM element visibility.

Type:
  • boolean
Source:

targetElementWidth :number

Gets the target DOM element width.

Type:
  • number
Source:

Methods

clickIntervals(clickTimes)

Calculates the interval between two sequential click times, calculates the duration for which the session was paused between the clicks times, subtracts the paused duration from the click interval, then adds the resulting click interval to the click intervals.

Parameters:
Name Type Description
clickTimes number | ClickTimes

A full or empty click times queue.

Source:

clickTimes(value)

Sets the session click times. When the maximum length of click times is reached, a click interval is created from the difference between those two click times, then the 0-index click time is removed. An empty array can be provided in place of a timestamp to clear the click times.

Parameters:
Name Type Description
value number | module:modules/Timer:Timestamp | Array

A click time or empty array.

Source:

getPauseDurationBetweenClicks(startClick, endClick) → {number}

Sum the duration of time that the session was paused between two sequential click times.

Parameters:
Name Type Description
startClick module:modules/Timer:Timestamp

The first accepted click.

endClick module:modules/Timer:Timestamp

The last accepted click.

Source:
Returns:

The summed pause durations in milliseconds.

Type
number

initialize()

Sets the initial state.

Source:

processReceive()

Handles the sesssion start, pause, and end states.

Source:

setRandomTargetElementDimensions()

Sets random target dimensions to a minimum of half the default target side value and a maximum of triple the side value plus half the side value.

Source:

setRandomTargetElementPositions()

Sets random target positions within the browser window.

Source:

targetElementClick()

An event listener delegatee that adds a click time randomizes the target DOM element position and dimensions, then adds points to the session score.

Source:

targetElementHeight(height)

Sets the target DOM element height.

Parameters:
Name Type Description
height number

The number to set the height dimension to.

Source:

targetElementLeft(left)

Sets the target DOM element left position.

Parameters:
Name Type Description
left number

The target left position.

Source:

targetElementTop(top)

Sets the target DOM element top position.

Parameters:
Name Type Description
top number

The number to set the top position to.

Source:

targetElementVisibility(visible)

Sets the target DOM element visibility.

Parameters:
Name Type Description
visible boolean

True if visible, else false.

Source:

targetElementWidth(width)

Sets the target DOM element width.

Parameters:
Name Type Description
width number

The number to set the width dimension to.

Source:

targetVisibilityElementClick()

An event listener delegatee that sets the target DOM element to the target visibility.

Source:

updateAverageClickElement()

Updates the average click DOM element content.

Source: