function tagLocation(e) {
console.log(e);
// console.log(e.offsetX, e.offsetY);
}
function throttleFn(fn, delay = 1000) {
let _this = this;
let exec = 0;
function throttle(_this, ...args) {
let elapsed = Date.now() - exec;
if (elapsed > delay) {
exec = Date.now();
fn.apply(_this, ...args);
}
}
return throttle;
}
document
.querySelector(".container")
.addEventListener("mousemove", throttleFn(tagLocation, 16));
如何将事件参数传递给tagLocation方法