Skip to content

Commit a261d04

Browse files
committed
BF: Use experiment.currentLoop for JS keyboard component
1 parent a0e8605 commit a261d04

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: psychopy/experiment/components/keyboard/__init__.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -507,20 +507,19 @@ def writeRoutineEndCodeJS(self, buff):
507507
"}\n"
508508
% self.params)
509509

510-
code += ("// store data for %s (%s)\n" %
511-
(currLoop.params['name'], currLoop.type))
510+
code += "// store data for current loop\n"
512511

513512
buff.writeIndentedLines(code % self.params)
514513

515514
code = (
516515
"// update the trial handler\n"
517-
"if (currentLoop instanceof MultiStairHandler) {\n"
516+
"if (psychoJS.experiment.currentLoop instanceof MultiStairHandler) {\n"
518517
)
519518
buff.writeIndentedLines(code % self.params)
520519

521520
buff.setIndentLevel(1, relative=True)
522521
code = (
523-
"currentLoop.addResponse(%(name)s.corr, level);\n"
522+
"psychoJS.experiment.currentLoop.addResponse(%(name)s.corr, level);\n"
524523
)
525524
buff.writeIndentedLines(code % self.params)
526525

@@ -544,6 +543,6 @@ def writeRoutineEndCodeJS(self, buff):
544543
" }}\n\n")
545544
else:
546545
code += " }}\n\n"
547-
buff.writeIndentedLines(code.format(loopName=currLoop.params['name'], name=name))
546+
buff.writeIndentedLines(code.format(name=name))
548547
# Stop keyboard
549548
buff.writeIndentedLines("%(name)s.stop();\n" % self.params)

0 commit comments

Comments
 (0)