Delay action (changing opacity of image) after specific amount of time after a mouse click

I’m creating a task where participants are supposed to click on a specific location on the screen and when they do, I change the opacity of an image hiding there from 0 to 1 so that it becomes visible.
I’ve got that working, but I’d really like to delay the change in opacity to only occur after 2 seconds have passed since the mouse click, and have that mouse-click timer reset after each time. Maybe I missed it in another thread, but is there built-in mouse time we can access? Or would I need to start a timer within the mouse-click if-statement, and then

Current JS code in Each Frame:

if ((mouse.getPressed()[0] === 1)) {
    if (mouse.isPressedIn(corrDiffPoly1_L)) {
        corrImage1L_opac = 1;
        corrImage1_isDone = 1;
    } else {
        corrImage1L_opac = 0;

What I’m guessing I’d need to do if there is no builtin mouse timer is something like:

if ((mouse.getPressed()[0] === 1)) {
    if (mouse.isPressedIn(corrDiffPoly1_L)) {
        mouseTimer = new util.Clock();

if ((mouseTimer >= 2)) {
        corrImage1L_opac = 1;
        corrImage1_isDone = 1;
} else {
        corrImage1L_opac = 0;

Any suggestions?

I think that goes in the right direction. I’ve got two suggestions:

Use CountdownTimer?
You could use the CountdownTimer. If I understand it correctly (see the source code here), it works like this:

// Start counting down 2 seconds
mouseTimer = new CountdownTimer(2);
// Get number of seconds left
mouseTimer.getTime();

Create only one timer
If you create a new timer every trial, you could get quite a lot of timers running all in parallel, which can affect performance. Instead, you could create one timer at the start and reset it.

mouserTimer.reset(2);