Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 548 Bytes

README.md

File metadata and controls

19 lines (12 loc) · 548 Bytes

Debounce

A function to execute another function after a specified delay. Really useful when you want to ensure a function isn't called too frequently. For example, if you want to send search criteria to a server after the user types, but don't wish to sent too many server calls, this method can be used.

Example

import debounce from "debounce.js";

function performSearch(term) {
   return debounce(executeSearch, 500);
}

Arguments

  • fn - The method to execute
  • delay - The delay in execution in milliseconds