// 节流
function thro(func, wait) {
let timeOut;
return function () {
if (!timeOut) {
timeOut = setTimeout(() => {
func();
timeOut = null;
}, wait);
}
};
}
function handle() {
console.log(Math.random());
}
document.getElementById("button").onclick = thro(handle, 2000);