| Index: pkg/polymer/lib/src/loader.dart
|
| diff --git a/pkg/polymer/lib/src/loader.dart b/pkg/polymer/lib/src/loader.dart
|
| index 772d54df2cee9397b49e67a8d46bd7ab2238d9d8..ff597adc8e456541a0c5d9dd64f17f3b235a5ec2 100644
|
| --- a/pkg/polymer/lib/src/loader.dart
|
| +++ b/pkg/polymer/lib/src/loader.dart
|
| @@ -68,6 +68,8 @@ void startPolymer(List<Function> initializers, [bool deployMode = true]) {
|
| for (var initializer in initializers) {
|
| initializer();
|
| }
|
| +
|
| + _watchWaitingFor();
|
| }
|
|
|
| /// Configures [initPolymer] making it optimized for deployment to the internet.
|
| @@ -160,3 +162,31 @@ void _initializeLogging() {
|
| // Listen to the polymer logs and print them to the console.
|
| polymerLogger.onRecord.listen((rec) {print(rec);});
|
| }
|
| +
|
| +/// Watches the waitingFor queue and if it fails to make progress then prints
|
| +/// a message to the console.
|
| +void _watchWaitingFor() {
|
| + int lastWaiting = Polymer.waitingFor.length;
|
| + int lastAlert;
|
| + new Timer.periodic(new Duration(seconds: 1), (Timer timer) {
|
| + var waiting = Polymer.waitingFor;
|
| + // Done, cancel timer.
|
| + if (waiting.isEmpty) {
|
| + timer.cancel();
|
| + return;
|
| + }
|
| + // Made progress, don't alert.
|
| + if (waiting.length != lastWaiting) {
|
| + lastWaiting = waiting.length;
|
| + return;
|
| + }
|
| + // Only alert once per waiting state.
|
| + if (lastAlert == lastWaiting) return;
|
| + lastAlert = lastWaiting;
|
| +
|
| + print('No elements registered in a while, but still waiting on '
|
| + '${waiting.length} elements to be registered. Check that you have a '
|
| + 'class with an @CustomTag annotation for each of the following tags: '
|
| + '${waiting.map((e) => "'${e.attributes['name']}'").join(', ')}');
|
| + });
|
| +}
|
|
|