Conversation
The role plugin's strategy and the reference game's scoring and prompt
were FUNCTION parameters so jsPsych wouldn't call a callback before the
trial, which made jsPsych warn whenever a string was passed.
- role: strategy takes a preset; a custom rule moves to assign_roles
- reference-game: scoring takes a preset; a custom function moves to
score_function; prompt takes HTML or { director, matcher }
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The role plugin's
strategyand the reference game'sscoringandprompteach took either a string or a function, and were declaredParameterType.FUNCTIONso jsPsych wouldn't call a callback before the trial. As a result, jsPsych warned "A non-function value was provided for the function parameter" whenever a string was passed, including the defaults. The fix separates presets from callbacks, so neither parameter mixes the two.Changes
role
strategyis aSTRING:"join_order","random", or"rotate".(snapshot, ctx) => roleMapmoves to the newassign_roles(FUNCTION), which still requiresready.assign_roles.reference-game
scoringis aSTRING:"per_slot"or"all_or_nothing". A custom(assignment, targets) => numbermoves to the newscore_function(FUNCTION).promptisCOMPLEX: an HTML string or{ director, matcher }. The role is known before the trial, so a per-role object covers what(role) => htmldid, and a dynamic() => …still works.This breaks code that passes a function to
strategy,scoring, orprompt. Each plugin has aminorchangeset, and the Upgrading guide lists the changes.Docs and examples
Both READMEs, the role package's docs page, both site reference pages, and the examples'
promptusages are updated.Testing
assign_rolesguard, the preset check,score_function, and the per-roleprompt.npm run buildand the docs build are clean.🤖 Generated with Claude Code