Skip to content

Commit b86d20c

Browse files
committed
Added ability to trigger when reached end of scroll
1 parent e29782d commit b86d20c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

addon/mixins/scrollable.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import Ember from 'ember';
22

33
const {
4-
run: { scheduleOnce }
4+
run: { scheduleOnce, bind, debounce }
55
} = Ember;
66

77
export default Ember.Mixin.create({
88
classNameBindings: [':as-scrollable', ':tse-scrollable', 'horizontal'],
99

1010
horizontal: false,
1111
autoHide: true,
12+
scrollBuffer: 50,
1213

1314
didInsertElement() {
1415
this._super(...arguments);
@@ -22,14 +23,27 @@ export default Ember.Mixin.create({
2223
this._destroyTrackpadScrollEmulator();
2324
},
2425

26+
sendScrollEnd() {
27+
this.sendAction('scrollEnd');
28+
},
29+
2530
_setupTrackpadScrollEmulator() {
26-
this.$().TrackpadScrollEmulator({ wrapContent: false, autoHide: this.get('autoHide') });
31+
this.$().TrackpadScrollEmulator({
32+
wrapContent: false,
33+
autoHide: this.get('autoHide'),
34+
onScrollEnd: bind(this, this._onScrollEnd),
35+
scrollBuffer: this.get('scrollBuffer')
36+
});
2737
},
2838

2939
_destroyTrackpadScrollEmulator() {
3040
this.$().TrackpadScrollEmulator('destroy');
3141
},
3242

43+
_onScrollEnd() {
44+
debounce(this, this.sendScrollEnd, 200);
45+
},
46+
3347
actions: {
3448
recalculate() {
3549
this.$().TrackpadScrollEmulator('recalculate');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"ember-cli-htmlbars": "^1.0.3",
4848
"ember-cli-node-assets": "0.1.3",
4949
"ember-component-inbound-actions": "1.0.1",
50-
"trackpad-scroll-emulator": "git://github.com/taras/trackpad-scroll-emulator.git#dd5e916727e63ea2f1bf1ccad4099c99ab7303fc"
50+
"trackpad-scroll-emulator": "taras/trackpad-scroll-emulator.git#28d071bd3a8c25e46c5737dde0ff46c0620f81d4"
5151
},
5252
"ember-addon": {
5353
"configPath": "tests/dummy/config"

0 commit comments

Comments
 (0)