github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/stories/utils/delayed-array.js (about)

     1  import { A } from '@ember/array';
     2  import ArrayProxy from '@ember/array/proxy';
     3  import { next } from '@ember/runloop';
     4  
     5  /**
     6   * This is an array whose content is empty until the next
     7   * tick, which fixes Storybook race condition rendering
     8   * problems.
     9   */
    10  
    11  export default ArrayProxy.extend({
    12    init(array) {
    13      this.set('content', A([]));
    14      this._super(...arguments);
    15  
    16      next(this, () => {
    17        this.set('content', A(array));
    18      });
    19    },
    20  });