JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" onclick="fire()" >CB1
<br />
<input type="checkbox" onclick="fire()" >CB2

JavaScript

function_lock = false

fire = function() {
    // First, check the lock
    if (function_lock) return;
    
    // We passed the lock, so imemdiately lock it to stop others
    function_lock = true;
    
    console.log("This message will appear once, until the lock is released")
  
    // Do your work. I use a simple Timeout.
    window.setTimeout(function() {
        // When the work finishes, release the lock.
        function_lock = false;
    }, 2000);
}