JSFiddle - React, Tailwind, and code Playground

HTML

<button>Click me as many times as you want, I will only fire once</button>

JavaScript

var delay = ( function () {
    var ticker = null;

    return function( callback, ms ) {
        if ( ticker !== null ) {
            clearTimeout( ticker )
        }

        ticker = setTimeout(callback, ms)
    }
} () )

$(document).ready(function() {
    // Pass delay two parameters, the first one is the callback
    // You want to delay, the second is the time in milliseconds to wait
    $("button").on( "click", function() {
    	delay ( function() { alert("here I am") }, 1000 )
    });
});