github.com/thomasobenaus/nomad@v0.11.1/ui/app/services/watch-list.js (about)

     1  import { computed } from '@ember/object';
     2  import { readOnly } from '@ember/object/computed';
     3  import { copy } from 'ember-copy';
     4  import Service from '@ember/service';
     5  
     6  let list = {};
     7  
     8  export default Service.extend({
     9    _list: computed(() => copy(list, true)),
    10  
    11    list: readOnly('_list'),
    12  
    13    init() {
    14      this._super(...arguments);
    15      list = {};
    16    },
    17  
    18    getIndexFor(url) {
    19      return list[url] || 1;
    20    },
    21  
    22    setIndexFor(url, value) {
    23      list[url] = +value;
    24    },
    25  });