mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-26 16:26:44 +03:00
Cleanup a bit of javascript
This commit is contained in:
parent
0b8ec5c664
commit
938c209869
3 changed files with 54 additions and 48 deletions
8
dev/prototype.js
vendored
8
dev/prototype.js
vendored
|
|
@ -53,7 +53,7 @@
|
|||
return function(...args) {
|
||||
timer && clearTimeout(timer);
|
||||
timer = setTimeout(()=>{
|
||||
func.apply(this, args)
|
||||
func.apply(this, args);
|
||||
timer = 0;
|
||||
}, ms);
|
||||
};
|
||||
|
|
@ -68,12 +68,10 @@
|
|||
Function.prototype.throttle = function(ms) {
|
||||
let func = this, timer;
|
||||
return function(...args) {
|
||||
if (!timer) {
|
||||
timer = setTimeout(()=>{
|
||||
func.apply(this, args)
|
||||
timer = timer || setTimeout(()=>{
|
||||
func.apply(this, args);
|
||||
timer = 0;
|
||||
}, ms);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue