OLD | NEW |
1 // Copyright (c) 2016, 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 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'package:observatory/models.dart' | 9 import 'package:observatory/models.dart' |
10 show ErrorRef; | 10 show ErrorRef; |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | 11 import 'package:observatory/src/elements/helpers/tag.dart'; |
12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
13 | 13 |
14 class ErrorRefElement extends HtmlElement implements Renderable { | 14 class ErrorRefElement extends HtmlElement implements Renderable { |
15 static const tag = const Tag<ErrorRefElement>('error-ref-wrapped'); | 15 static const tag = const Tag<ErrorRefElement>('error-ref'); |
16 | 16 |
17 RenderingScheduler<ErrorRefElement> _r; | 17 RenderingScheduler<ErrorRefElement> _r; |
18 | 18 |
19 Stream<RenderedEvent<ErrorRefElement>> get onRendered => _r.onRendered; | 19 Stream<RenderedEvent<ErrorRefElement>> get onRendered => _r.onRendered; |
20 | 20 |
21 ErrorRef _error; | 21 ErrorRef _error; |
22 | 22 |
23 ErrorRef get error => _error; | 23 ErrorRef get error => _error; |
24 | 24 |
25 factory ErrorRefElement(ErrorRef error, {RenderingQueue queue}) { | 25 factory ErrorRefElement(ErrorRef error, {RenderingQueue queue}) { |
26 assert(error != null); | 26 assert(error != null); |
27 ErrorRefElement e = document.createElement(tag.name); | 27 ErrorRefElement e = document.createElement(tag.name); |
28 e._r = new RenderingScheduler<ErrorRefElement>(e, queue: queue); | 28 e._r = new RenderingScheduler<ErrorRefElement>(e, queue: queue); |
29 e._error = error; | 29 e._error = error; |
30 return e; | 30 return e; |
31 } | 31 } |
32 | 32 |
(...skipping 11 matching lines...) Expand all Loading... |
44 children = []; | 44 children = []; |
45 _r.disable(notify: true); | 45 _r.disable(notify: true); |
46 } | 46 } |
47 | 47 |
48 void render() { | 48 void render() { |
49 children = [ | 49 children = [ |
50 new PreElement()..text = error.message | 50 new PreElement()..text = error.message |
51 ]; | 51 ]; |
52 } | 52 } |
53 } | 53 } |
OLD | NEW |