laravel-jstools
Version:
JS tools for building front-side of Laravel applications
15 lines (14 loc) • 532 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
window.timeoutList = {};
window.csrf = document.querySelector('meta[name="csrf-token"]').content;
window.timeout = function (uniqueId, callback, time = 500) {
if (window.timeoutList.hasOwnProperty(uniqueId)) {
const timerId = window.timeoutList[uniqueId];
clearTimeout(timerId);
}
window.timeoutList[uniqueId] = setTimeout(() => {
delete window.timeoutList[uniqueId];
callback();
}, time);
};