Skip to content

Commit

Permalink
conditionally wrap the callonce function
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpm committed Nov 20, 2024
1 parent 79b38cf commit 5160036
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/resources/views/crud/inc/filters_navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ function updateDatatablesOnFilterChange(filterName, filterValue, update_url = fa
*
* FROM: https://stackoverflow.com/questions/27787768/debounce-function-in-jquery
*/
function callFunctionOnce(func, within = 300, timerId = null) {
if(typeof callFunctionOnce !== 'function') {
function callFunctionOnce(func, within = 300, timerId = null) {
window.callOnceTimers = window.callOnceTimers || {};
timerId = timerId || func;
if (window.callOnceTimers[timerId]) {
clearTimeout(window.callOnceTimers[timerId]);
}
window.callOnceTimers[timerId] = setTimeout(func, within);
}
}
function refreshDatatablesOnFilterChange(url)
Expand Down

0 comments on commit 5160036

Please sign in to comment.