stefanocudini / leaflet-layerJSON

Build dynamic JSON Layer via Ajax/JSONP with caching
https://opengeo.tech/maps/leaflet-layerjson/
MIT License
92 stars 28 forks source link

use debounce function on map moveend zoomend #12

Closed stefanocudini closed 8 years ago

stefanocudini commented 8 years ago
        function debouncer(func, timeout) {
            var timeoutID;
            timeout = timeout || 300;
            return function () {
                var scope = this , args = arguments;
                clearTimeout( timeoutID );
                timeoutID = setTimeout( function () {
                    func.apply( scope , Array.prototype.slice.call( args ) );
                }, timeout);
            };
        }