OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
turnidge
2016/07/28 17:15:56
2016, you get the idea.
cbernaschina
2016/07/28 17:33:20
Done.
| |
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 import 'dart:html'; | |
6 import 'dart:async'; | |
7 | |
8 import 'package:observatory/app.dart'; | |
9 import 'package:observatory/repositories.dart' show ScriptRepository; | |
10 import 'package:observatory/service_html.dart' show SourceLocation; | |
11 import 'package:observatory/src/elements/source_link.dart'; | |
12 import 'package:observatory/src/elements/helpers/tag.dart'; | |
13 import 'package:observatory/src/elements/shims/binding.dart'; | |
14 | |
15 @bindable | |
16 class SourceLinkElementWrapper extends HtmlElement { | |
17 static const binder = const Binder<SourceLinkElementWrapper>(const { | |
18 'location' : #location | |
19 }); | |
20 | |
21 static const tag = const Tag<SourceLinkElementWrapper>('source-link'); | |
22 | |
23 SourceLocation _location; | |
24 SourceLocation get location => location; | |
25 set location(SourceLocation location) { _location = location; render(); } | |
26 | |
27 SourceLinkElementWrapper.created() : super.created() { | |
28 binder.registerCallback(this); | |
29 createShadowRoot(); | |
30 render(); | |
31 } | |
32 | |
33 @override | |
34 void attached() { | |
35 super.attached(); | |
36 render(); | |
37 } | |
38 | |
39 Future render() async { | |
40 shadowRoot.children = []; | |
41 if (_location == null) return; | |
42 | |
43 ScriptRepository repository = new ScriptRepository(_location.isolate); | |
44 | |
45 shadowRoot.children = [ | |
46 new StyleElement() | |
47 ..text = '@import "packages/observatory/src/elements/css/shared.css";', | |
48 new SourceLinkElement(_location.isolate, _location, repository, | |
49 queue: ObservatoryApplication.app.queue) | |
50 ]; | |
51 } | |
52 } | |
OLD | NEW |