Skip to content

Instantly share code, notes, and snippets.

View jmlivingston's full-sized avatar

John Livingston jmlivingston

View GitHub Profile
@jmlivingston
jmlivingston / debounce.md
Last active March 9, 2020 17:29 — forked from nmsdvid/new_gist_file.js
Simple JavaScript Debounce Function

Definition

Prevents function from being called until delay has passed without being called. This prevents excessive computer operations like API calls or heavy calculations.

Pattern

Curried function with two parameters: function and delay. As long as the debounced function continues to be called within the delay, the original function will not be called.

Use Cases