Commit 5590a3cb by Dányi Bence

webui: function throttle code moved

parent 101c2871
......@@ -331,6 +331,24 @@ $(function() {
return n.toFixed(precision) + ' ' + suffix[i];
}
/**
* Returns throttled function
*/
function throttle(f) {
var disabled = false;
return function() {
if(disabled) {
return
};
disabled = true;
setTimeout(function() {
disabled = false;
}, 700);
f.apply(this, arguments);
}
}
function Model() {
//alias for this
var self = this;
......@@ -373,24 +391,6 @@ $(function() {
})
/**
* Returns throttled function
*/
function throttle(f) {
var disabled = false;
return function() {
if(disabled) {
return
};
disabled = true;
setTimeout(function() {
disabled = false;
}, 700);
f.apply(null, arguments);
}
}
/**
* Delay the function call for `f` until `g` evaluates true
* Default check interval is 1 sec
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment