Giter Club home page Giter Club logo

javascript-debounce's Introduction

javascript-debounce

npm version

A lightweight, dependency-free JavaScript module for debouncing functions based on David Walsh's debounce function.

Key Features

  • Dependency-free
  • AMD/CommonJS module support

javascript-debounce is also really tiny:

Uncompressed 909 bytes
Minified 664 bytes
Minified and gzipped 406 bytes

Getting javascript-debounce

Adding javascript-debounce to your project is easy! You've got a couple options:

  • Download a tagged version from GitHub and do it yourself (old school).
  • Install via Bower: bower install javascript-debounce
  • Install via npm: npm install javascript-debounce

Usage

debounce(callback, delay)

callback

Type: Function

A function to be executed after delay milliseconds.

delay

Type: Number

The delay, in milliseconds, after the final event invokation at which time callback will be fired.

Example

if ('addEventListener' in window) {
    var handleResize = debounce(function() {
        console.log('This method fired 250ms after the resize event was last invoked.');
    }, 250);

    window.addEventListener('resize', handleResize);
}

Acknowledgments

javascript-debounce is based on David Walsh's code and article JavaScript Debounce Function. His site is an invaluable resource for Web developers.

javascript-debounce is written and maintained by Jason Garber with the help of some great contributors.

License

javascript-debounce is freely available under The MIT License. Go forth and make the Web a more accessible place.

javascript-debounce's People

Contributors

allybee avatar jgarber623 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.