Remove unused gh-infinite-scroll component and infinite-scroll mixin
no issue - this component and mixin has been replaced by `ember-infinity`
This commit is contained in:
parent
9ad5644031
commit
6ae881e918
@ -1,10 +0,0 @@
|
||||
import Component from 'ember-component';
|
||||
import InfiniteScrollMixin from 'ghost-admin/mixins/infinite-scroll';
|
||||
|
||||
export default Component.extend(InfiniteScrollMixin, {
|
||||
actions: {
|
||||
checkScroll() {
|
||||
this._checkScroll();
|
||||
}
|
||||
}
|
||||
});
|
@ -1,42 +0,0 @@
|
||||
import Mixin from 'ember-metal/mixin';
|
||||
import run from 'ember-runloop';
|
||||
|
||||
export default Mixin.create({
|
||||
isLoading: false,
|
||||
triggerPoint: 100,
|
||||
|
||||
/**
|
||||
* Determines if we are past a scroll point where we need to fetch the next page
|
||||
*/
|
||||
_checkScroll() {
|
||||
let element = this.get('element');
|
||||
let triggerPoint = this.get('triggerPoint');
|
||||
let isLoading = this.get('isLoading');
|
||||
|
||||
// If we haven't passed our threshold or we are already fetching content, exit
|
||||
if (isLoading || (element.scrollTop + element.clientHeight + triggerPoint <= element.scrollHeight)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendAction('fetch');
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
let el = this.get('element');
|
||||
|
||||
el.onscroll = run.bind(this, this._checkScroll);
|
||||
|
||||
// run on load, on the offchance that the initial load
|
||||
// did not fill the view.
|
||||
this._checkScroll();
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
// turn off the scroll handler
|
||||
this.get('element').onscroll = null;
|
||||
}
|
||||
});
|
@ -1 +0,0 @@
|
||||
{{yield (action "checkScroll")}}
|
@ -1,18 +0,0 @@
|
||||
/* jshint expr:true */
|
||||
import EmberObject from 'ember-object';
|
||||
import InfiniteScrollMixin from 'ghost-admin/mixins/infinite-scroll';
|
||||
import {
|
||||
describe,
|
||||
it
|
||||
} from 'mocha';
|
||||
import {expect} from 'chai';
|
||||
|
||||
describe('Unit: Mixin: infinite-scroll', function () {
|
||||
// Replace this with your real tests.
|
||||
it('works', function () {
|
||||
let InfiniteScrollObject = EmberObject.extend(InfiniteScrollMixin);
|
||||
let subject = InfiniteScrollObject.create();
|
||||
|
||||
expect(subject).to.be.ok;
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user