mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-01 13:12:23 +00:00
* I need that gitignore file * Temp Commit - DOES NOT COMPILE * THE SHIT WORKS * Readme change * Disposal Unit --> TGUI * mmmm yes CI which may not actually work * New GitIgnore * ITS TGUI-NEXT BABY * Doc update * CI tweak * Chmod * And again * *sigh* * Lets appreciate the irony of me failing CI stages * 0/1 --> True/False * Fixes some update nonsense * CI Update * Lets try this * What about this maybe * NVM is hurting me * I swear to god * A little bit of validation in my life * V3 BABYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY * Fixes * Fixes NaN appearing for a few frames when UIs open * Fixes + Crew Monitor * Corn + Steel + Mochi Fixes * Forgot this * Fixes from stylemistake * Code Change * Adds logout proc * Offline implications + Resizeable crew monitor * Change locate() to locateUID() * Change div --> box
24 lines
644 B
JavaScript
24 lines
644 B
JavaScript
/**
|
|
* Returns a function, that, as long as it continues to be invoked, will
|
|
* not be triggered. The function will be called after it stops being
|
|
* called for N milliseconds. If `immediate` is passed, trigger the
|
|
* function on the leading edge, instead of the trailing.
|
|
*/
|
|
export const debounce = (fn, time, immediate = false) => {
|
|
let timeout;
|
|
return (...args) => {
|
|
const later = () => {
|
|
timeout = null;
|
|
if (!immediate) {
|
|
fn(...args);
|
|
}
|
|
};
|
|
const callNow = immediate && !timeout;
|
|
clearTimeout(timeout);
|
|
timeout = setTimeout(later, time);
|
|
if (callNow) {
|
|
fn(...args);
|
|
}
|
|
};
|
|
};
|