Подтвердить что ты не робот

Как реализовать основную функцию в полимерных приложениях

Я хочу реализовать основную функцию в приложении с использованием полимера.

Я попытался реализовать основную функцию в файле дротика, где реализован полимерный код. Код не выполняется.

Включение второго дротика script с основной функцией не допускается -

Где моя ошибка? Tnx Mica.

4b9b3361

Ответ 1

index.html

 <head>
   <!-- <link rel="import" href="packages/polymer/polymer.html"> not necessary anymore (only in elements)-->
   <!-- <script src="packages/web_components/platform.js"></script>
        not necessary anymore with Polymer >= 0.14.0 -->
   <!-- <script src="packages/web_components/dart_support.js"></script> 
        not necessary anymore with Polymer >= 0.15.0 -->

   <!-- old -->
   <script type="application/dart">
      export 'package:polymer/init.dart';</script> 

   <!-- new  -->
   <script type="application/dart">export 'index.dart';</script>
 </head>
 <body>
   ...
   <!-- ... when you use a custom main method (see https://code.google.com/p/dart/issues/detail?id=17546#c16) -->
   <script type="application/dart" src="index.dart"></script>
 </body>

index.dart

Полимер 0,17,0 (Polymer.js 1.0)

main() async {
  await initPolymer();
  // Any other code here.
}

До Полимер 0.17.0

Полимер 0.16.1 вводит более простой способ инициализации. Вместо main() используйте метод, аннотированный с помощью @whenPolymerReady

// >= Polymer 0.16.1
import 'package:polymer/polymer.dart';
export 'package:polymer/init.dart';

@whenPolymerReady
void onReady() {
  /// Custom setup code here.
}

До Polymer.dart 0.16.1

// >= Polymer 0.16.0
import "package:polymer/polymer.dart";

main() {
  initPolymer().then((zone) => zone.run(() {
    // code here works most of the time
    Polymer.onReady.then((_) {     
      // some things must wait until onReady callback is called
      // for an example look at the discussion linked below
    });
  }));
}

Подробнее см. журнал изменений Polymer 0.16.0 at https://pub.dartlang.org/packages/polymer

До Полимера 0.16.0

// < Polymer 0.16.0    
import "package:polymer/polymer.dart";

main() {
  initPolymer().run(() {
    // code here works most of the time
    Polymer.onReady.then((_) {     
      // some things must wait until onReady callback is called
      // for an example look at the discussion linked below
    });
  });
}

простая всплывающая подсказка, работающая в dartium, а не как javascript