OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library error_ref_element; | |
6 | |
7 import 'dart:html'; | |
8 import 'package:observatory/repositories.dart' show ErrorRefMock; | |
9 import 'package:observatory/service_html.dart' show ServiceMap; | |
10 import 'package:observatory/src/elements/error_ref.dart'; | |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | |
12 import 'package:observatory/src/elements/shims/binding.dart'; | |
13 | |
14 class ErrorRefElementWrapper extends HtmlElement { | |
15 | |
16 static final binder = new Binder<ErrorRefElementWrapper>( | |
17 const [const Binding('ref')]); | |
18 | |
19 static const tag = const Tag<ErrorRefElementWrapper>('error-ref'); | |
20 | |
21 ServiceMap _error; | |
22 ServiceMap get ref => _error; | |
23 | |
24 ErrorRefElementWrapper.created() : super.created() { | |
25 binder.registerCallback(this); | |
26 createShadowRoot(); | |
27 render(); | |
28 } | |
29 | |
30 @override | |
31 void attached() { | |
32 super.attached(); | |
33 render(); | |
34 } | |
35 | |
36 void render() { | |
rmacnak
2016/07/11 17:54:01
I think this is much nicer than the html templates
Cutch
2016/07/11 17:55:39
Me too!
cbernaschina
2016/07/11 18:14:11
Done.
| |
37 shadowRoot.children = []; | |
38 if (ref == null) return; | |
39 | |
40 shadowRoot.children = [ | |
41 new StyleElement() | |
42 ..text = '@import "packages/observatory/src/elements/css/shared.css";', | |
43 new ErrorRefElement(new ErrorRefMock(message: ref['message'])) | |
44 ]; | |
45 } | |
46 } | |
OLD | NEW |