Class: Observer

observer~Observer(category_sets) → {Observer}

new Observer(category_sets) → {Observer}

The class does the actual observation. It keeps the records made during the observation and sends them to the backend after the observation is stopped.
Parameters:
Name Type Description
category_sets The array of the category sets to be used in the observation.
Source:
Returns:
Constructed observer.
Type
Observer

Methods

categoryClick(index)

Delegates the click of a category button to the correct category. It adds the (possible) record returned by the category to the list of all the records made during the observation.
Parameters:
Name Type Description
index number The index of the category button that was clicked.
Source:

continueClick()

The event handler continues the observation.
Source:

pauseClick()

The event handler pauses the observation.
Source:

startClick()

The event handler starts the observation. It sends an AJAX notification to the backend when the observation is started.
Source:

stopClick()

The event handler stops the observation. It disables the continue, pause and category buttons. If some categories were still on, it stops them and creates records accordingly. It sends the recorded information to the backend with AJAX and redirects the user to the summary page (on success).
Source:

tick()

Updates the observation clock and all the categories based on it.
Source:

(inner) addRecord(record)

The private method adds the record to the records list if it's not undefined. The method is used by categoryClick() and stopClick().
Parameters:
Name Type Description
record The record or undefined if there is nothing to be added.
Source:

(inner) initialize(this_)

The private method initializes the observer. It creates the category buttons and adds them to the HTML element tree.
Parameters:
Name Type Description
this_ Observer The observer to be initialized.
Source: