Skip to content

Commit

Permalink
Use an arrow function instead
Browse files Browse the repository at this point in the history
I confirmed that it compiles to the same. output in the Babel repl.
  • Loading branch information
mmun committed Aug 18, 2015
1 parent 4badbf9 commit 9a340ae
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions addon/components/ember-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,28 @@ export default Ember.Component.extend({
this.initContentOffset();
this.setupScroller();

var component = this;
function callback() {
var element = component.element;
let callback = () => {
var element = this.element;
if (element) {
var offsetX = element.scrollLeft;
var offsetY = element.scrollTop;

if (offsetX !== component.offsetX || offsetY !== component.offsetY) {
component.offsetX = offsetX;
component.offsetY = offsetY;
if (offsetX !== this.offsetX || offsetY !== this.offsetY) {
this.offsetX = offsetX;
this.offsetY = offsetY;

var index = component.cellLayout.indexAt(offsetX, offsetY, component.width, component.height);
var count = component.cellLayout.count(offsetX, offsetY, component.width, component.height);
if (index !== component.currentIndex || count !== component.currentCount) {
component.currentIndex = index;
component.currentCount = count;
Ember.run(component, 'rerender');
var index = this.cellLayout.indexAt(offsetX, offsetY, this.width, this.height);
var count = this.cellLayout.count(offsetX, offsetY, this.width, this.height);
if (index !== this.currentIndex || count !== this.currentCount) {
this.currentIndex = index;
this.currentCount = count;
Ember.run(this, 'rerender');
}
}
}
requestAnimationFrame(callback);
}
};

callback();
},
willDestroyElement() {
Expand Down

1 comment on commit 9a340ae

@mmun
Copy link
Contributor Author

@mmun mmun commented on 9a340ae Aug 18, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really necessary, but it makes greping for this.whatever easier.

Please sign in to comment.