Skip to content

Commit

Permalink
update some linting stuff (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer authored and RobbieTheWagner committed Apr 24, 2018
1 parent 2101a93 commit e8a2890
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
28 changes: 14 additions & 14 deletions addon/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Mixin from '@ember/object/mixin'
import { get, computed } from '@ember/object'
import { inject } from '@ember/service'
import { getOwner } from '@ember/application'
import { scheduleOnce } from '@ember/runloop'
import Mixin from '@ember/object/mixin';
import { get, computed } from '@ember/object';
import { inject } from '@ember/service';
import { getOwner } from '@ember/application';
import { scheduleOnce } from '@ember/runloop';

export default Mixin.create({
scheduler: inject('scheduler'),
Expand All @@ -26,30 +26,30 @@ export default Mixin.create({

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

const delayScrollTop = get(this, 'service.delayScrollTop')
const delayScrollTop = get(this, 'service.delayScrollTop');

if (!delayScrollTop) {
scheduleOnce('render', this, () => this.updateScrollPosition(transitions))
scheduleOnce('render', this, () => this.updateScrollPosition(transitions));
} else {
// as described in ember-app-scheduler, this addon can be used to delay rendering until after First Meaningful Paint.
// If you loading your routes progressively, this may be a good option to delay scrollTop until the remaining DOM elements are painted.
this.get('scheduler').scheduleWork('afterContentPaint', () => {
this.updateScrollPosition(transitions)
})
this.updateScrollPosition(transitions);
});
}
},

updateScrollPosition (transitions) {
const lastTransition = transitions[transitions.length - 1]
const lastTransition = transitions[transitions.length - 1];

let routerPath
if (typeof get(lastTransition, 'handler._router') !== 'undefined') {
routerPath = 'handler._router'
routerPath = 'handler._router';
} else {
routerPath = 'handler.router'
routerPath = 'handler.router';
}
const url = get(lastTransition, `${routerPath}.currentURL`)
const hashElement = url ? document.getElementById(url.split('#').pop()) : null
const url = get(lastTransition, `${routerPath}.currentURL`);
const hashElement = url ? document.getElementById(url.split('#').pop()) : null;

let scrollPosition;

Expand Down
1 change: 0 additions & 1 deletion addon/locations/router-scroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import HistoryLocation from '@ember/routing/history-location';
import { set, get } from '@ember/object';

Expand Down
3 changes: 1 addition & 2 deletions addon/services/router-scroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import Service from '@ember/service';
import { getWithDefault, computed, set, get } from '@ember/object';
import { typeOf } from '@ember/utils';
Expand Down Expand Up @@ -52,7 +51,7 @@ export default Service.extend({
const scrollMap = get(this, 'scrollMap');
const stateUuid = get(window, 'history.state.uuid');

set(this, 'key', stateUuid);
set(this, 'key', stateUuid); // eslint-disable-line ember/no-side-effects
const key = getWithDefault(this, 'key', '-1');

return getWithDefault(scrollMap, key, { x: 0, y: 0 });
Expand Down
1 change: 0 additions & 1 deletion app/locations/router-scroll.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/* eslint-disable */
export { default } from 'ember-router-scroll/locations/router-scroll';
1 change: 0 additions & 1 deletion app/services/router-scroll.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/* eslint-disable */
export { default } from 'ember-router-scroll/services/router-scroll';

0 comments on commit e8a2890

Please sign in to comment.