【发布时间】:2015-05-15 20:20:18
【问题描述】:
我正在阅读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 的简写吗?如果它有任何不同,那又如何?
【问题讨论】:
标签: javascript ecmascript-6 arrow-functions