I want to implement a main function in an app using polymer.
I tried to implement the main function in the dart file, where the polymer code is implemented. The code
index.html
...
index.dart
Polymer 0.17.0 (Polymer.js 1.0)
main() async {
await initPolymer();
// Any other code here.
}
Before Polymer 0.17.0
Polymer 0.16.1 introduces a simpler way of initialization.
Instead of main()
use a method annotated with @whenPolymerReady
// >= Polymer 0.16.1
import 'package:polymer/polymer.dart';
export 'package:polymer/init.dart';
@whenPolymerReady
void onReady() {
/// Custom setup code here.
}
Before 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
});
}));
}
For more details look at the changelog of Polymer 0.16.0 at https://pub.dartlang.org/packages/polymer
Before 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
});
});
}
simple tooltip working in dartium, not as javascript