摘要:
阅读全文
摘要:
/** * * @param fn {Function} 实际要执行的函数 * @param delay {Number} 延迟时间,也就是阈值,单位是毫秒(ms) * * @return {Function} 返回一个“去弹跳”了的函数 */ function debounce(fn, delay 阅读全文
摘要:
很多时候,需要为某个函数指定一个固定的 this 对象,最简单的方式即是使用闭包来获取一个不变的 this 对象。this.x = 9; const module = { x: 81, getX: function() { return this.x; } }; module.getX(); // 阅读全文