JSFiddle - React, Tailwind, and code Playground
by Pankaj Kargirwar
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Debounce Example</title>
</head>
<body>
<input type="text" id="input" placeholder="Type something...">
</body>
</html>
JavaScript
import Debouncer from "@jsfiddle/kargirwar/us07tdmw/6.js"
class Test {
constructor() {
console.log('new');
document.addEventListener('DOMContentLoaded', () => {
this.debouncer = new Debouncer(10);
const txtInput = document.querySelector('#input');
txtInput.addEventListener('change', () => {
console.log(txtInput.value);
});
});
}
}
new Test();