Skip to content

Instantly share code, notes, and snippets.

@zjffun
Last active September 12, 2022 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zjffun/e3d711f12d599d674f63d576c7a45a29 to your computer and use it in GitHub Desktop.
Save zjffun/e3d711f12d599d674f63d576c7a45a29 to your computer and use it in GitHub Desktop.
v2ex-879440
function debounce(func) {
return function (...args) {
console.log("args", args);
func(...args);
};
}
let password = document.querySelector('[name="password"]');
const debouncedFn = debounce(function (e) {
console.log("e", e);
});
console.log("debouncedFn", debouncedFn);
password.addEventListener("keyup", debouncedFn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment