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

     1  import { inject as service } from '@ember/service';
     2  import { get } from '@ember/object';
     3  import Component from '@ember/component';
     4  const append = function(content) {
     5    this.element.appendChild(content);
     6  };
     7  export default Component.extend({
     8    buffer: service('dom-buffer'),
     9    init: function() {
    10      this._super(...arguments);
    11      this.append = append.bind(this);
    12    },
    13    didInsertElement: function() {
    14      get(this, 'buffer').on('add', this.append);
    15    },
    16    didDestroyElement: function() {
    17      get(this, 'buffer').off('add', this.append);
    18    },
    19  });