github.com/outbrain/consul@v1.4.5/ui-v2/app/services/dom-buffer.js (about)

     1  import Service from '@ember/service';
     2  import Evented from '@ember/object/evented';
     3  const buffer = {};
     4  export default Service.extend(Evented, {
     5    // TODO: Consider renaming this and/or
     6    // `delete`ing the buffer (but not the DOM element)
     7    // flush should flush, but maybe being able to re-flush
     8    // after you've flushed could be handy
     9    flush: function(name) {
    10      return buffer[name];
    11    },
    12    add: function(name, dom) {
    13      this.trigger('add', dom);
    14      buffer[name] = dom;
    15      return dom;
    16    },
    17    remove: function(name) {
    18      buffer[name].remove();
    19      delete buffer[name];
    20    },
    21  });