Ghost/core/client/app/views/paginated-scroll-box.js
Austin Burdine 86e47ee4a9 removes usage of prototype extensions
No issue
- removes more usage of function prototype extensions in favor of Ember functions
- replaces some event calls with the direct function name
- adds comments to functions replaced with the event name
2015-06-15 14:07:25 -04:00

28 lines
778 B
JavaScript

import Ember from 'ember';
import setScrollClassName from 'ghost/utils/set-scroll-classname';
import PaginationViewMixin from 'ghost/mixins/pagination-view-infinite-scroll';
var PaginatedScrollBox = Ember.View.extend(PaginationViewMixin, {
/**
* attach the scroll class handler event
*/
attachScrollClassHandler: function () {
var el = this.$();
el.on('scroll', Ember.run.bind(el, setScrollClassName, {
target: el.closest('.content-list'),
offset: 10
}));
},
didInsertElement: function () {
this.attachScrollClassHandler();
},
willDestroyElement: function () {
// removes scroll class handler event
this.$().off('scroll');
}
});
export default PaginatedScrollBox;