mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
throttle should check for valid args (#113)
This commit is contained in:
@@ -6,6 +6,12 @@
|
||||
* @param {function} func function to invoke
|
||||
*/
|
||||
function throttle(throttleTime, func) {
|
||||
if (typeof throttleTime !== 'number' || throttleTime <= 0) {
|
||||
throw Error('throttle: invalid throttleTime arg, must be a number: ' + throttleTime);
|
||||
}
|
||||
if (typeof func !== 'function') {
|
||||
throw Error('throttle: invalid func arg, must be a function: ' + func);
|
||||
}
|
||||
let timer, lastInvoke = 0;
|
||||
return function() {
|
||||
let args = arguments;
|
||||
|
||||
Reference in New Issue
Block a user