misterzorgy
misterzorgy

Reputation: 123

How to determine when component ready in Polymer?

For example I have component with internal dom-repeat template. I need to know when all internal elements ready and then do some actions. But ready and attached handlers fires before internal templates ready. How can I do that right? Thank you!

  <template>
    <div class="b-item-content">     
      <span class="b-item-content-theme">[[subject]]</span>
      <span class="b-item-separator">[[separator]]</span>
      <span class="b-item-content-text">[[snippet]]</span>
      <div class="b-item-attachments">
      <div>{{attachments}}</div>
        <template is="dom-repeat" items="[[attachments]]">
          <!--[[_constructAttachment(item)]]-->
          <attachment-item item="[[item]]"></attachment-item>
        </template>
      </div>    
    </div>     
  </template>

The main question.. If I have an element with 100 internal custom elements that have bindings with my parent element and model of parent element has changed. So how can I catch time when all internal custom elements rendered itself?? Thank you

Upvotes: 1

Views: 757

Answers (1)

Flavio Ochoa
Flavio Ochoa

Reputation: 961

This maybe will help you:

window.addEventListener('WebComponentsReady', function(e) {
  // imports are loaded and elements have been registered
  console.log('Components are ready');
});`

Here and here you will find information about it.

Upvotes: 1

Related Questions