Skip to content

Tech Blog

All about computer technology

Search

Categories

  • Algorithms
  • Articles
  • Concepts
  • Data Structures
  • Database
  • General
  • HR
  • HTML
  • Interview Questions
  • Javascript
  • PHP
  • React
  • Security
  • Web development

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Simulate a debounce function

http://obscurejavascript.tumblr.com/post/115595038489/debounce-in-javascript

var debounce = function(callback, delay) {
    var timeout = null;

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

        clearTimeout(timeout);
        timeout = setTimeout(function() {
            callback.apply(context, args);
        }, delay);
    };
};
Posted on April 29, 2017Author shahprashantCategories Javascript

Post navigation

Previous Previous post: Debounce and Throttle in Javascript
Next Next post: Combinations of a String
Proudly powered by WordPress