Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner committed Aug 19, 2016
2 parents 86af512 + 4518d29 commit e978f60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions addon/mixins/scroll-operator.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,21 @@ export default Mixin.create({
_attachEvents() {
if(!this.get('fastboot') || !this.get('fastboot.isFastBoot')) {
const onScroll = () => {
run.debounce(this, this._setScrollTop, this._scrollingTimeout);
const scrollPosition = $(window).scrollTop();
run.debounce(this, this._setScrollTop, scrollPosition, this._scrollingTimeout);
};
$(document).on('touchmove.scrollable', onScroll);
$(window).on('scroll.scrollable', onScroll);
}
},

_detachEvents() {
if(!this.get('fastboot') || !this.get('fastboot.isFastBoot')) {
$(document).off('.scrollable');
$(window).off('.scrollable');
}
},

/**
* Determine if transition is triggered by browser forward/back buttons.
* Credit: https://github.com/emberjs/ember.js/issues/3087
Expand All @@ -79,19 +87,12 @@ export default Mixin.create({
return transition && transition.sequence > 1 && transition.hasOwnProperty('urlMethod');
},

_detachEvents() {
if(!this.get('fastboot') || !this.get('fastboot.isFastBoot')) {
$(document).off('.scrollable');
$(window).off('.scrollable');
}
},

/**
* Set currentPosition to $(window).scrollTop value.
*/
_setScrollTop() {
_setScrollTop(scrollPosition = 0) {
if(!this.get('fastboot') || !this.get('fastboot.isFastBoot')) {
this.set('controller.currentPosition', $(window).scrollTop());
this.set('controller.currentPosition', scrollPosition);
}
}
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-scroll-operator",
"version": "0.0.6",
"version": "0.0.7",
"description": "Handle the preservation of scrolling positions when traversing routes via the browser's back and forward buttons.",
"directories": {
"doc": "doc",
Expand Down

0 comments on commit e978f60

Please sign in to comment.