2018-02-08 23:06:10 +00:00
|
|
|
import { readOnly } from '@ember/object/computed';
|
2019-03-26 04:55:06 +00:00
|
|
|
import { copy } from 'ember-copy';
|
2018-02-08 23:06:10 +00:00
|
|
|
import Service from '@ember/service';
|
|
|
|
|
2018-02-17 02:59:40 +00:00
|
|
|
let list = {};
|
2018-02-08 23:06:10 +00:00
|
|
|
|
|
|
|
export default Service.extend({
|
|
|
|
list: readOnly(function() {
|
|
|
|
return copy(list, true);
|
|
|
|
}),
|
|
|
|
|
2018-02-17 02:59:40 +00:00
|
|
|
init() {
|
2019-10-15 18:32:58 +00:00
|
|
|
this._super(...arguments);
|
2018-02-17 02:59:40 +00:00
|
|
|
list = {};
|
|
|
|
},
|
|
|
|
|
2018-02-08 23:06:10 +00:00
|
|
|
getIndexFor(url) {
|
2018-03-21 20:28:56 +00:00
|
|
|
return list[url] || 1;
|
2018-02-08 23:06:10 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setIndexFor(url, value) {
|
2018-08-21 20:47:01 +00:00
|
|
|
list[url] = +value;
|
2018-02-08 23:06:10 +00:00
|
|
|
},
|
|
|
|
});
|