Skip to content

Latest commit

 

History

History
100 lines (58 loc) · 7.69 KB

File metadata and controls

100 lines (58 loc) · 7.69 KB

@jspsych/plugin-video-button-response

2.0.0

Major Changes

  • #2858 f90c0ef9 Thanks @bjoluc! - - Make button_html a function parameter which, given a choice's text and its index, returns the HTML string of the choice's button. If you were previously passing a string to button_html, like <button>%choice%</button>, you can now pass the function

    function (choice) {
      return '<button class="jspsych-btn">' + choice + "</button>";
    }

    Similarly, if you were using the array syntax, like

    ['<button class="a">%choice%</button>', '<button class="b">%choice%</button>', '<button class="a">%choice%</button>']

    an easy way to migrate your trial definition is to pass a function which accesses your array and replaces the %choice% placeholder:

    function (choice, choice_index) {
      return ['<button class="a">%choice%</button>', '<button class="b">%choice%</button>', '<button class="a">%choice%</button>'][choice_index].replace("%choice%", choice);
    }

    From there on, you can further simplify your function. For instance, if the intention of the above example is to have alternating button classes, the button_html function might be rewritten as

    function (choice, choice_index) {
      return '<button class="' + (choice_index % 2 === 0 ? "a" : "b") + '">' + choice + "</button>";
    }
    • Simplify the button DOM structure and styling: Buttons are no longer wrapped in individual container divs for spacing and data-choice attributes. Instead, each button is assigned its data-choice attribute and all buttons are direct children of the button group container div. The container div, in turn, utilizes a flexbox layout to position the buttons.
  • #3339 74b4adc7 Thanks @jodeleeuw! - finishTrial() now clears the display and any timeouts set with pluginApi.setTimeout()

Minor Changes

  • #3326 c5a0dbb1 Thanks @vzhang03! - Updated all plugins to implement new pluginInfo standard that contains version, data generated and new documentation style to match migration of docs to be integrated with the code and packages themselves"

1.2.0

Minor Changes

  • #3298 a4088529 Thanks @thtTNT! - Issue (#3289), Add parameter "enable_button_after" to all "-button-response" plugins

1.1.3

Patch Changes

  • #3184 9acfa29c Thanks @bjoluc! - Point to source maps via canonical unpkg URLs in NPM-published browser builds. This prevents 404 errors when using redirecting CDN URLs (as described in #3043).

1.1.2

Patch Changes

1.1.1

Patch Changes

  • #2632 a17f423f Thanks @bjoluc! - Improve browser compatibility when loading via unpkg.com, i.e. when using the dist/index.browser.min.js build artifact.

1.1.0

Minor Changes

Patch Changes

  • #2359 a8ab2eb8 Thanks @jodeleeuw! - Fixes the response_allowed_while_playing parameter to use the stop time of the video as the event that enables a response.
  • #2359 d2a8b4ab Thanks @jodeleeuw! - Throw an error when the stimulus parameter is not an array, see #1537 and #1530.

1.0.0

Major Changes

  • #2183 c8760b1 Thanks @jodeleeuw, @becky-gilbert, @bjoluc! - jsPsych is now fully modular, with individual NPM packages for the core library, plugins, and extensions.

    To support this change, we've made a number of breaking changes. We've added a guide for migrating from version 6.x to 7.x to the documentation, and updated the hello world tutorial with instructions for configuring jsPsych in three different ways. In addition to enabling package management, some of the benefits that this change provides include an improved developer experience with IntelliSense code hints, proper encapsulation of jsPsych so that multiple instances can be run on the same page, and easier integration with modern JavaScript tools like bundlers.

Minor Changes

  • #2129 f37f64a Thanks @jodeleeuw! - All duration measurements, including response times, are now rounded to the nearest millisecond. We changed this because the precision that performance.now() generates is misleading in this context and removing the (often very long) decimal component of the measurement will save space in the data files.

Patch Changes

  • #1533 7b16a1d Thanks @becky-gilbert! - Fixed a bug that caused the trial to not end when the trial_ends_after_video parameter was set to true and the video ended at a specific time via the stop parameter.