summaryrefslogtreecommitdiff
path: root/html/content/js/Utils/throttle.js
blob: ccfc9a7ee32b49299bae57bb6aaf37d5c9acf17a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
define(function () {
    return function (func, limit) {
        var timeout;
        var inThrottle;
        return function () {
            var context = this, args = arguments;
            if (!inThrottle) {
                func.apply(context, args);
                inThrottle = true;
            }
            setTimeout(() => inThrottle = false, limit);
            
        };
    };
});