diff --git a/lib/hexo/index.ts b/lib/hexo/index.ts index eb041289e2..63d3a77070 100644 --- a/lib/hexo/index.ts +++ b/lib/hexo/index.ts @@ -93,14 +93,12 @@ const createLoadThemeRoute = function(generatorResult, locals, ctx) { }; }; -function debounce(func, wait) { - let timeout; +function debounce(func: () => void, wait: number) { + let timeout: NodeJS.Timeout; return function() { - const context = this; - const args = arguments; clearTimeout(timeout); timeout = setTimeout(() => { - func.apply(context, args); + func.apply(this); }, wait); }; }