Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Unified Diff: runtime/observatory/lib/src/elements/error_ref.dart

Issue 2202943002: Converted Observatory error-ref element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/error_ref.dart
diff --git a/runtime/observatory/lib/src/elements/error_ref.dart b/runtime/observatory/lib/src/elements/error_ref.dart
index d69726bdbb791d45a690d11fe1a349f9a9984e6c..b30dd90fbc2abc31b4b470dba8a32c70115f092e 100644
--- a/runtime/observatory/lib/src/elements/error_ref.dart
+++ b/runtime/observatory/lib/src/elements/error_ref.dart
@@ -1,13 +1,52 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library error_ref_element;
-import 'package:polymer/polymer.dart';
-import 'service_ref.dart';
+import 'dart:html';
+import 'dart:async';
+import 'package:observatory/models.dart'
+ show ErrorRef;
+import 'package:observatory/src/elements/helpers/tag.dart';
+import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
+
+class ErrorRefElement extends HtmlElement implements Renderable {
+ static const tag = const Tag<ErrorRefElement>('error-ref-wrapped');
+
+ RenderingScheduler<ErrorRefElement> _r;
+
+ Stream<RenderedEvent<ErrorRefElement>> get onRendered => _r.onRendered;
+
+ ErrorRef _error;
+ ErrorRef get error => _error;
+
+ factory ErrorRefElement(ErrorRef error, {RenderingQueue queue}) {
+ assert(error != null);
+ ErrorRefElement e = document.createElement(tag.name);
+ e._r = new RenderingScheduler<ErrorRefElement>(e, queue: queue);
+ e._error = error;
+ return e;
+ }
-@CustomTag('error-ref')
-class ErrorRefElement extends ServiceRefElement {
ErrorRefElement.created() : super.created();
+
+ @override
+ void attached() {
+ super.attached();
+ _r.enable();
+ }
+
+ @override
+ void detached() {
+ super.detached();
+ children = [];
+ _r.disable(notify: true);
+ }
+
+ void render() {
+ children = [
+ new PreElement()..text = error.message
+ ];
+ }
}
« no previous file with comments | « runtime/observatory/lib/src/elements/css/shared.css ('k') | runtime/observatory/lib/src/elements/error_ref.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698