jsPsych has a nice description of different ways of using the timeline. In our experiments, this.timeline is initialized as an empty array at the beginning of the program. To add event to the timeline, we use this.timeline.push(functionName) within the buildTimeline() function. See an example:
We can call this.timeline.push(functionName) after each function, but it can be helpful to have a section where multiple functions were pushed. This is helpful when we test specific parts of the experiment and need to comment out lots of functions. The only exception is that if there are loops in the experiment and the function is embedded in the loop, this.timeline.push() has to stay within the loop.