mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-02-01 21:32:01 -08:00
fix conflict with function name. fix page ready request loop.
This commit is contained in:
parent
b4d184ad46
commit
baa8746fab
2 changed files with 48 additions and 36 deletions
|
|
@ -234,33 +234,6 @@ function getComputedDims(elem) {
|
|||
|
||||
/** Functions for asynchronous operations. */
|
||||
|
||||
function debounce(handler, timeout_ms) {
|
||||
/** Debounces a function call.
|
||||
*
|
||||
* NOTE: This will NOT work if called from within a class.
|
||||
* It will drop `this` from scope.
|
||||
*
|
||||
* Repeated calls to the debounce handler will not call the handler until there are
|
||||
* no new calls to the debounce handler for timeout_ms time.
|
||||
*
|
||||
* Example:
|
||||
* function add(x, y) { return x + y; }
|
||||
* let debounce_handler = debounce(add, 5000);
|
||||
* let res;
|
||||
* for (let i = 0; i < 10; i++) {
|
||||
* res = debounce_handler(i, 100);
|
||||
* }
|
||||
* console.log("Result:", res);
|
||||
*
|
||||
* This example will print "Result: 109".
|
||||
*/
|
||||
let timer = null;
|
||||
return (...args) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => handler(...args), timeout_ms);
|
||||
};
|
||||
}
|
||||
|
||||
function waitForElement(selector, timeout_ms) {
|
||||
/** Promise that waits for an element to exist in DOM. */
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue