mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
fix(loginUsername): add throttle for search (#39)
This commit is contained in:
parent
f99dbac95f
commit
af30eb431d
2 changed files with 16 additions and 1 deletions
|
|
@ -58,3 +58,13 @@ export function shuffleAList(list) {
|
|||
});
|
||||
return newSorts;
|
||||
}
|
||||
|
||||
export function throttle(fn, time) {
|
||||
let isRun = false;
|
||||
return function () {
|
||||
if (isRun) return;
|
||||
isRun = true;
|
||||
fn.apply(this, arguments);
|
||||
setTimeout(() => { isRun = false }, time);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue