ui: move debouncecall
This commit is contained in:
parent
f8ba3f6d89
commit
91f8cc1399
1 changed files with 10 additions and 0 deletions
|
|
@ -29,6 +29,16 @@ export function debounce(callback, wait, context = this) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function debounceCall(func, wait) {
|
||||||
|
let timeout;
|
||||||
|
return function (...args) {
|
||||||
|
const context = this;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(() => func.apply(context, args), wait);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function randomInt(a, b) {
|
export function randomInt(a, b) {
|
||||||
const min = (b ? a : 0) - 0.5;
|
const min = (b ? a : 0) - 0.5;
|
||||||
const max = b || a || Number.MAX_SAFE_INTEGER;
|
const max = b || a || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue