# JavaScript event

Definition

A custom variable that processes raw data (for example, the subject coordinates, or the distance moved) and produces a point event (i.e., with no duration) for each sample of the track, based on an algorithm.

Use cases

▪Zone visits detector. For example, detect when the subject has visited 80% of the zones. Use the event to calculate the latency of that event.

▪tip Browse to my.noldus.com, log in or register and choose Downloads > EthoVision XT > Drivers and tools. There you can download an example of a JavaScript event variable that detects when a subject has visited a specific percentage of zones. Simply copy the code to the JavaScript Event window and follow the instructions (see below).

Calculation

The main difference with the JavaScript continuous variable is that the value specified in SetOutput() is either 0 or 1 and has no duration.

See JavaScript continuous > Calculation

How to specify a JavaScript event variable

1.In the Analysis profile, under Custom Variables, click the button next to JavaScript event.

2.Follow the rest of the procedure in JavaScript continuous > To specify a JavaScript continuous variable.

Notes

▪In the Trial Statistics tab, select Latency to First to calculate the latency of the event. Latency of a dependent variable is calculated from the start of the track, even when you define time bins and nesting intervals.

See also

▪JavaScript continuous

▪JavaScript state

▪Commands and functions for JavaScript variables