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

Side by Side 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, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library error_ref_element; 5 library error_ref_element;
6 6
7 import 'package:polymer/polymer.dart'; 7 import 'dart:html';
8 import 'service_ref.dart'; 8 import 'dart:async';
9 import 'package:observatory/models.dart'
10 show ErrorRef;
11 import 'package:observatory/src/elements/helpers/tag.dart';
12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 13
10 @CustomTag('error-ref') 14 class ErrorRefElement extends HtmlElement implements Renderable {
11 class ErrorRefElement extends ServiceRefElement { 15 static const tag = const Tag<ErrorRefElement>('error-ref-wrapped');
16
17 RenderingScheduler<ErrorRefElement> _r;
18
19 Stream<RenderedEvent<ErrorRefElement>> get onRendered => _r.onRendered;
20
21 ErrorRef _error;
22 ErrorRef get error => _error;
23
24 factory ErrorRefElement(ErrorRef error, {RenderingQueue queue}) {
25 assert(error != null);
26 ErrorRefElement e = document.createElement(tag.name);
27 e._r = new RenderingScheduler<ErrorRefElement>(e, queue: queue);
28 e._error = error;
29 return e;
30 }
31
12 ErrorRefElement.created() : super.created(); 32 ErrorRefElement.created() : super.created();
33
34 @override
35 void attached() {
36 super.attached();
37 _r.enable();
38 }
39
40 @override
41 void detached() {
42 super.detached();
43 children = [];
44 _r.disable(notify: true);
45 }
46
47 void render() {
48 children = [
49 new PreElement()..text = error.message
50 ];
51 }
13 } 52 }
OLDNEW
« 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