1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 21:30:39 +00:00

optimize code (#6517)

This commit is contained in:
杨顺强
2024-08-08 18:08:09 +08:00
committed by GitHub
parent e2bb71e8c9
commit 33bfffa6c1
12 changed files with 163 additions and 90 deletions

View File

@@ -53,6 +53,22 @@ const getWikPageLink = (pageId) => {
return `${origin}${pathname}?page_id=${pageId}`;
};
const throttle = (fn, delay) => {
let timer;
return function () {
let _this = this;
let args = arguments;
if (timer) {
return;
}
timer = setTimeout(function () {
fn.apply(_this, args);
timer = null;
}, delay);
};
};
export {
generatorBase64Code,
generateUniqueId,
@@ -60,4 +76,5 @@ export {
getIconURL,
getCurrentPageConfig,
getWikPageLink,
throttle,
};