WEB_DEVELOPERSZZ Telegram 276
Debouncing function in Javascript.

Debouncing makes sure that a function doesn't run too often in a short period of time.

// Debouncing util
function debounce(func, wait) {

let timeout;

  return function(...args) {
    clearTimeout(timeout);
    timeout = setTimeout(() => func.apply(this, args), wait);
  };
}

// Usage
const handleResize = debounce(() => {
  console.log('Resize event');
}, 300);

window.addEventListener('resize', handleResize);



tgoop.com/Web_developerszz/276
Create:
Last Update:

Debouncing function in Javascript.

Debouncing makes sure that a function doesn't run too often in a short period of time.

// Debouncing util
function debounce(func, wait) {

let timeout;

  return function(...args) {
    clearTimeout(timeout);
    timeout = setTimeout(() => func.apply(this, args), wait);
  };
}

// Usage
const handleResize = debounce(() => {
  console.log('Resize event');
}, 300);

window.addEventListener('resize', handleResize);

BY Web Developer




Share with your friend now:
tgoop.com/Web_developerszz/276

View MORE
Open in Telegram


Telegram News

Date: |

Add up to 50 administrators Choose quality over quantity. Remember that one high-quality post is better than five short publications of questionable value. The channel also called on people to turn out for illegal assemblies and listed the things that participants should bring along with them, showing prior planning was in the works for riots. The messages also incited people to hurl toxic gas bombs at police and MTR stations, he added. Judge Hui described Ng as inciting others to “commit a massacre” with three posts teaching people to make “toxic chlorine gas bombs,” target police stations, police quarters and the city’s metro stations. This offence was “rather serious,” the court said. 4How to customize a Telegram channel?
from us


Telegram Web Developer
FROM American