github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/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 class WatchListService extends Service {
     9    @computed
    10    get _list() {
    11      return copy(list, true);
    12    }
    13  
    14    @readOnly('_list') list;
    15  
    16    constructor() {
    17      super(...arguments);
    18      list = {};
    19    }
    20  
    21    getIndexFor(url) {
    22      return list[url] || 1;
    23    }
    24  
    25    setIndexFor(url, value) {
    26      list[url] = +value;
    27    }
    28  }