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

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

Issue 2211603002: Centralized event streams (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with master 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 7
8 import 'package:observatory/app.dart'; 8 import 'package:observatory/app.dart';
9 import 'package:observatory/service_html.dart' show Script; 9 import 'package:observatory/service_html.dart' show Script;
10 import 'package:observatory/src/elements/script_ref.dart'; 10 import 'package:observatory/src/elements/script_ref.dart';
11 import 'package:observatory/src/elements/helpers/tag.dart'; 11 import 'package:observatory/src/elements/helpers/tag.dart';
12 import 'package:observatory/src/elements/shims/binding.dart'; 12 import 'package:observatory/src/elements/shims/binding.dart';
13 13
14 @bindable 14 @bindable
15 class ScriptRefElementWrapper extends HtmlElement { 15 class ScriptRefElementWrapper extends HtmlElement {
16 static const binder = const Binder<ScriptRefElementWrapper>(const { 16 static const binder = const Binder<ScriptRefElementWrapper>(const {
17 'ref': #ref 17 'ref': #ref
18 }); 18 });
19 19
20 static const tag = const Tag<ScriptRefElementWrapper>('script-ref'); 20 static const tag = const Tag<ScriptRefElementWrapper>('script-ref');
21 21
22 Script _script; 22 Script _script;
23
23 Script get ref => _script; 24 Script get ref => _script;
24 set ref(Script script) { _script = script; render(); } 25
26 set ref(Script value) {
27 _script = value;
28 render();
29 }
25 30
26 ScriptRefElementWrapper.created() : super.created() { 31 ScriptRefElementWrapper.created() : super.created() {
27 binder.registerCallback(this); 32 binder.registerCallback(this);
28 createShadowRoot(); 33 createShadowRoot();
29 render(); 34 render();
30 } 35 }
31 36
32 @override 37 @override
33 void attached() { 38 void attached() {
34 super.attached(); 39 super.attached();
35 render(); 40 render();
36 } 41 }
37 42
38 Future render() async { 43 Future render() async {
39 shadowRoot.children = []; 44 shadowRoot.children = [];
40 if (_script == null) return; 45 if (_script == null) {
46 return;
47 }
41 48
42 shadowRoot.children = [ 49 shadowRoot.children = [
43 new StyleElement() 50 new StyleElement()
44 ..text = ''' 51 ..text = '''
45 script-ref-wrapped > a[href]:hover { 52 script-ref-wrapped > a[href]:hover {
46 text-decoration: underline; 53 text-decoration: underline;
47 } 54 }
48 script-ref-wrapped > a[href] { 55 script-ref-wrapped > a[href] {
49 color: #0489c3; 56 color: #0489c3;
50 text-decoration: none; 57 text-decoration: none;
51 }''', 58 }''',
52 new ScriptRefElement(_script.isolate, _script, 59 new ScriptRefElement(_script.isolate, _script,
53 queue: ObservatoryApplication.app.queue) 60 queue: ObservatoryApplication.app.queue)
54 ]; 61 ];
55 } 62 }
56 } 63 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/script_ref.dart ('k') | runtime/observatory/lib/src/elements/source_link.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698