update bundle configs

This commit is contained in:
Yanzhen Yu
2018-10-11 16:46:34 +08:00
parent 40f29e5353
commit 215b2b319b
4 changed files with 31 additions and 3 deletions

View File

@@ -48,13 +48,13 @@ export function throttle<T>(
let args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout);
window.clearTimeout(timeout);
timeout = null;
}
previous = now;
func.apply(context, args);
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(() => {
timeout = window.setTimeout(() => {
previous = options.leading === false ? 0 : Date.now();
timeout = null;
func.apply(context, args);