3

I'm having trouble calling a polymer element's function right after calling initPolymer(); If I do

void main(){
    initPolymer();
    var polymerElement = querySelector('myElement');
    polymerElement.myFunction();
}

This will work in the vm but not in the compiled js version. If I do a timer to delay the function call, both of them work. Does anyone know how to fix it? I tried to find if there's a callback function for initPolymer() when the elements are ready, but couldn't find it.

Thanks, Yi

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
yi chen
  • 241
  • 4
  • 11
  • 3
    `initPolymer().run(() => myPolymerStuff())` could help. Didn't test it tough, to be honest. EDIT: which is exactly what Günter posted. Should read before commenting. – MarioP Jan 13 '14 at 10:30

0 Answers0