Skip to content

Commit

Permalink
Deprecate locations/router-scroll for Embers own implementation close D…
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Jun 11, 2019
1 parent 4452258 commit 719b3eb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions addon/locations/router-scroll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import HistoryLocation from '@ember/routing/history-location';
import { set, get } from '@ember/object';
import { deprecate } from '@ember/application/deprecations';

const uuid = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
Expand All @@ -9,12 +10,30 @@ const uuid = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) =

export default HistoryLocation.extend({
pushState(path) {
deprecate(
`If you are overriding ember-router-scroll's implementation of "pushState", then you can import and override like so: import HistoryLocation from '@ember/routing/history-location';`,
false,
{
id: 'ember-router-scroll',
until: '2.0.0'
}
);

const state = { path, uuid: uuid() };
get(this, 'history').pushState(state, null, path);
set(this, '_previousURL', this.getURL());
},

replaceState(path) {
deprecate(
`If you are overriding ember-router-scroll's implementation of "replaceState", then you can import and override like so: import HistoryLocation from '@ember/routing/history-location';`,
false,
{
id: 'ember-router-scroll',
until: '2.0.0'
}
);

const state = { path, uuid: uuid() };
get(this, 'history').replaceState(state, null, path);
set(this, '_previousURL', this.getURL());
Expand Down

0 comments on commit 719b3eb

Please sign in to comment.