Skip to content

Allow timeline_variables to be a function #3712

Description

@jodeleeuw

The timeline_variables array is evaluated once, when the timeline is defined. This means every value in the table has to be known at authoring time.

Users frequently need tables that depend on runtime state that isn't available yet — a language selected by the participant, a condition assigned by the server after consent, or a value computed from an earlier trial. Allowing timeline_variables to be a function would let the table be built when the timeline node starts instead:

timeline_variables: () => [
  { stimulus: `stim/${condition}/face1.png`, prompt: strings[lang].go },
  { stimulus: `stim/${condition}/face2.png`, prompt: strings[lang].go },
]

Open question: whether the function is evaluated once when the timeline node starts, or re-evaluated on each repetition. These have meaningfully different implications for how many trials a node contains.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions