Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjan Singh committed Aug 15, 2016
1 parent a00e1b9 commit 9b0be62
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default Ember.Mixin.create({
didTransition(transitions, ...args) {
this._super(transitions, ...args);

if (get(this, 'isFastBoot')) return;
if (get(this, 'isFastBoot')) { return; }

next(() => this.updateScrollPosition(transitions));
},
Expand Down
16 changes: 8 additions & 8 deletions addon/locations/router-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember';

const {
get,
HistoryLocation
HistoryLocation,
} = Ember;

export default HistoryLocation.extend({
Expand All @@ -11,15 +11,15 @@ export default HistoryLocation.extend({
this.stateCounter = 0;
},
pushState(path) {
let id = `${this.stateCounter++}`;
let state = { path, id };
const id = `${this.stateCounter++}`;
const state = { path, id };
get(this, 'history').pushState(state, null, path);
this._previousURL = this.getURL();
this._previousURL = this.getURL(); // eslint-disable-line no-underscore-dangle
},
replaceState(path) {
let id = `${this.stateCounter++}`;
let state = { path, id };
const id = `${this.stateCounter++}`;
const state = { path, id };
get(this, 'history').replaceState(state, null, path);
this._previousURL = this.getURL();
}
this._previousURL = this.getURL(); // eslint-disable-line no-underscore-dangle
},
});
19 changes: 11 additions & 8 deletions addon/services/router-scroll.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* global window */
import Ember from 'ember';

const {
get,
set,
computed,
getWithDefault,
Service
Service,
} = Ember;

export default Service.extend({
Expand All @@ -14,21 +15,23 @@ export default Service.extend({
set(this, 'scrollMap', {});
set(this, 'key', null);
},

update() {
let scrollMap = get(this, 'scrollMap');
let key = get(this, 'key');
const scrollMap = get(this, 'scrollMap');
const key = get(this, 'key');

if (key) {
set(scrollMap, key, { x: window.scrollX, y: window.scrollY });
}
},
position: computed(function() {
let scrollMap = get(this, 'scrollMap');
let stateId = get(window, 'history.state.id');

position: computed(function position() {
const scrollMap = get(this, 'scrollMap');
const stateId = get(window, 'history.state.id');

set(this, 'key', stateId);
let key = getWithDefault(this, 'key', '-1');
const key = getWithDefault(this, 'key', '-1');

return getWithDefault(scrollMap, key, { x: 0, y: 0 });
}).volatile()
}).volatile(),
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"build": "ember build",
"eslint": "eslint . --ignore-path .eslintignore",
"eslint": "eslint app/**/*.js addon/**/*.js tests/**/*.js --quiet --ignore-path .eslintignore",
"start": "ember server",
"test": "ember try:each"
},
Expand Down

0 comments on commit 9b0be62

Please sign in to comment.