mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
Fix class instance access in callback functions
by converting the affected functions to arrow functions to preserve the outer-scope `this`
This commit is contained in:
parent
ba9c495a21
commit
bb141c446a
@ -9,7 +9,7 @@ export class HardwareAPI {
|
|||||||
//it might be useful to open up a line of communication from the extension back to this page
|
//it might be useful to open up a line of communication from the extension back to this page
|
||||||
//script, again, this will have to pass through DOM events. For now speed is of no concern so I
|
//script, again, this will have to pass through DOM events. For now speed is of no concern so I
|
||||||
//will use jQuery
|
//will use jQuery
|
||||||
document.addEventListener("jspsych-activate", function (evt) {
|
document.addEventListener("jspsych-activate", (evt) => {
|
||||||
this.hardwareConnected = true;
|
this.hardwareConnected = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ export class MediaAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAudioBuffer(audioID) {
|
getAudioBuffer(audioID) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise((resolve, reject) => {
|
||||||
// check whether audio file already preloaded
|
// check whether audio file already preloaded
|
||||||
if (
|
if (
|
||||||
typeof this.audio_buffers[audioID] == "undefined" ||
|
typeof this.audio_buffers[audioID] == "undefined" ||
|
||||||
|
Loading…
Reference in New Issue
Block a user