| 508 | } |
| 509 | // https://dev.to/jeetvora331/throttling-in-javascript-easiest-explanation-1081 |
| 510 | function throttle(mainFunction, delay) { |
| 511 | let timerFlag = null; // Variable to keep track of the timer |
| 512 | |
| 513 | // Returning a throttled version |
| 514 | return (...args) => { |
| 515 | if (timerFlag === null) { |
| 516 | // If there is no timer currently running |
| 517 | mainFunction(...args); // Execute the main function |
| 518 | timerFlag = setTimeout(() => { |
| 519 | // Set a timer to clear the timerFlag after the specified delay |
| 520 | timerFlag = null; // Clear the timerFlag to allow the main function to be executed again |
| 521 | }, delay); |
| 522 | } |
| 523 | }; |
| 524 | } |
| 525 | const backup = () => { |
| 526 | // export data from https://chrome.google.com/webstore/detail/ppaojnbmmaigjmlpjaldnkgnklhicppk |
| 527 | (async () => { |