Polymer querySelector working on DartVM but not in Chrome after compile

后端 未结 1 1345
[愿得一人]
[愿得一人] 2020-11-28 15:12

Having a weird issue. In my Dart code I have some polymer components on the screen and one of them has a method I call from my main().

I grab a reference to it by do

相关标签:
1条回答
  • 2020-11-28 15:23

    When you run this code from the main() method it is probably a timing issue. You can try something like

    import "package:polymer/polymer.dart";
    
    main() {
      initPolymer().run(() {
        // code here works most of the time
        Polymer.onReady.then((e) {     
          // some things must wait until onReady callback is called
        });
      });
    }
    

    see also how to implement a main function in polymer apps

    0 讨论(0)
提交回复
热议问题