我在阅读ScrollListView源代码时,发现多次使用了() => {}
,例如在第25行。
this.cellReorderThreshold = () => {
var ratio = (this.CELLHEIGHT*this.cellsWithinViewportCount)/4;
return ratio < this.CELLHEIGHT ? 0 : ratio;
};
第31行,
this.container.addEventListener('scroll', () => this.onScroll(), false);
第88行。
resizeTimer = setTimeout(() => {
this.containerHeight = this.container.offsetHeight;
}, 250);
这是一个代替 function
的速记法,如果有任何不同之处,是什么?