display_while: Modify a timeline to execute within a loop

Description Usage Arguments Details Value See Also

View source: R/timeline_modify.R

Description

Modify a timeline to execute within a loop

Usage

1
display_while(timeline, loop_function)

Arguments

timeline

The timeline object

loop_function

A javascript function that returns true if loop repeats, false if terminates

Details

The display_while() function is used to modify an existing timeline object, and provides the ability to include while loops within an experiment. To use it, the user must supply the loop_function, a javascript function that executes at runtime and should evaluate to true or false. If the loop function returns true, then the timeline object will execute for another iteration; this condinues until the loop function returns false.

At present jaysire provides only limited tools for writing the loop function. The fn_data_condition() function allows a simple approach that allows the loop function to query the jsPsych data store, but only in a limited way. Future versions will (hopefully) provide a richer tool set for this. However, for users who are comfortable with writing javascript functions directly the insert_javascript() function may be useful.

Value

The modified timeline object

See Also

display_if, build_timeline, fn_data_condition, insert_javascript


djnavarro/jaysire documentation built on April 12, 2021, 4:25 a.m.