Skip to content

Commit a5c6468

Browse files
authored
Update throttle2.js
1 parent 0f8b591 commit a5c6468

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

demos/throttle/throttle2.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ container.onmousemove = throttle(getUserAction, 3000);
1212

1313
function throttle(func, wait) {
1414
var timeout;
15-
var previous = 0;
1615

1716
return function() {
18-
context = this;
19-
args = arguments;
17+
var context = this;
18+
var args = arguments;
2019
if (!timeout) {
2120
timeout = setTimeout(function(){
2221
timeout = null;
2322
func.apply(context, args)
2423
}, wait)
2524
}
26-
2725
}
28-
}
26+
}

0 commit comments

Comments
 (0)