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

Side by Side Diff: runtime/observatory/lib/src/elements/error_ref.dart

Issue 2119733003: Wrapping leaf nodes in non polymer elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted script-link 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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');
12 ErrorRefElement.created() : super.created(); 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) {
25 assert(error != null);
26 ErrorRefElement e = document.createElement(tag.name);
27 e._error = error;
28 return e;
29 }
30
31 ErrorRefElement.created() : super.created() {
32 _r = new RenderingScheduler<ErrorRefElement> (this);
33 }
34
35 @override
36 void attached() {
37 super.attached();
38 assert(error != null);
39 _r.scheduleRendering();
40 }
41
42 @override
43 void detached() {
44 super.detached();
45 children = [];
46 _r.scheduleNotification();
47 }
48
49 void render() {
50 children = [
51 new PreElement()..text = error.message
52 ];
53 }
13 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698