提交 6197d274 编写于 作者: Q qiang

chore: build

上级 34c7c04d
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -1196,15 +1196,15 @@ const ACTION_TYPE_EVENT = 20; ...@@ -1196,15 +1196,15 @@ const ACTION_TYPE_EVENT = 20;
* @param timer * @param timer
* @returns * @returns
*/ */
function debounce(fn, delay, timer) { function debounce(fn, delay, { clearTimeout, setTimeout }) {
let timeout; let timeout;
const newFn = function () { const newFn = function () {
timer.clearTimeout(timeout); clearTimeout(timeout);
const timerFn = () => fn.apply(this, arguments); const timerFn = () => fn.apply(this, arguments);
timeout = timer.setTimeout(timerFn, delay); timeout = setTimeout(timerFn, delay);
}; };
newFn.cancel = function () { newFn.cancel = function () {
timer.clearTimeout(timeout); clearTimeout(timeout);
}; };
return newFn; return newFn;
} }
......
...@@ -136,7 +136,7 @@ export declare const DATA_RE: RegExp; ...@@ -136,7 +136,7 @@ export declare const DATA_RE: RegExp;
* @param timer * @param timer
* @returns * @returns
*/ */
export declare function debounce(fn: Function, delay: number, timer: Timer): { export declare function debounce(fn: Function, delay: number, { clearTimeout, setTimeout }: Timer): {
(this: any): void; (this: any): void;
cancel(): void; cancel(): void;
}; };
......
...@@ -1192,15 +1192,15 @@ const ACTION_TYPE_EVENT = 20; ...@@ -1192,15 +1192,15 @@ const ACTION_TYPE_EVENT = 20;
* @param timer * @param timer
* @returns * @returns
*/ */
function debounce(fn, delay, timer) { function debounce(fn, delay, { clearTimeout, setTimeout }) {
let timeout; let timeout;
const newFn = function () { const newFn = function () {
timer.clearTimeout(timeout); clearTimeout(timeout);
const timerFn = () => fn.apply(this, arguments); const timerFn = () => fn.apply(this, arguments);
timeout = timer.setTimeout(timerFn, delay); timeout = setTimeout(timerFn, delay);
}; };
newFn.cancel = function () { newFn.cancel = function () {
timer.clearTimeout(timeout); clearTimeout(timeout);
}; };
return newFn; return newFn;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册