Welcome to mirror list, hosted at ThFree Co, Russian Federation.

debounce.js « utils « src « alpinejs « packages « alpinejs - github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 850a3b19fbce100addc1aca23a0a3d136958acec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

export function debounce(func, wait) {
    var timeout

    return function() {
        var context = this, args = arguments

        var later = function () {
            timeout = null

            func.apply(context, args)
        }

        clearTimeout(timeout)

        timeout = setTimeout(later, wait)
    }
}