Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@jspsych-contrib/extension-countdown
Advanced tools
jsPsych extension for adding a countdown during a trial
This extension adds a countdown during a trial.
None
Trial parameters can be set when adding the extension to a trial object.
let trial = {
type: jsPsych...,
extensions: [
{type: jsPsychExtensionWebgazer, params: {...}}
]
}
Parameter | Type | Default Value | Description |
---|---|---|---|
time | number | undefined | Time in milliseconds of the countdown |
update_time | number | 50 | How often to update the countdown display; in milliseconds |
format | function | (time) => String(Math.floor(time / 1000)) | The displayed content of the countdown. Receives the current time left in milliseconds and returns a string for display. |
None
These functions below are provided to enable a better interaction with the countdown. Note that all of the functions below must be prefixed with jsPsych.extensions.countdown
(e.g. jsPsych.extensions.countdown.pause()
).
pause()
Pauses the countdown.
resume()
Resumes the countdown.
get_time_left()
Gets how much time there is still left in milliseconds.
let jsPsych = initJsPsych({
extensions: [{ type: jsPsychExtensionCountdown }],
});
let trial = {
type: jsPsychHtmlKeyboardResponse,
stimulus: "Hello world",
extensions: [
{
type: jsPsychExtensionCountdown,
params: {
time: 5000,
update_time: 20,
format: (time) => {
if (time < 3000) {
document.querySelector(".jspsych-extension-countdown").style.color = "red";
}
let time_in_seconds = time / 1000;
let minutes = Math.floor(time_in_seconds / 60);
time_in_seconds -= minutes * 60;
let seconds = Math.floor(time_in_seconds);
let format_number = (number) => {
let temp_str = `0${number}`;
return temp_str.substring(temp_str.length - 2);
};
return `${format_number(minutes)}:${format_number(seconds)}`;
},
},
},
],
on_load: function () {
setTimeout(() => {
jsPsych.extensions.countdown.pause();
setTimeout(() => {
jsPsych.extensions.countdown.resume();
}, 2000);
}, 1000);
},
};
jsPsych.run([trial]);
FAQs
jsPsych extension for adding a countdown during a trial
The npm package @jspsych-contrib/extension-countdown receives a total of 1 weekly downloads. As such, @jspsych-contrib/extension-countdown popularity was classified as not popular.
We found that @jspsych-contrib/extension-countdown demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.