OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:html'; |
| 6 import 'package:observatory/service_html.dart'; |
| 7 import 'shims/binding.dart'; |
| 8 import 'helpers/tag.dart'; |
| 9 import 'isolate_ref.dart'; |
| 10 |
| 11 class IsolateRefElementWrapper extends HtmlElement { |
| 12 |
| 13 static final binder = new Binder<IsolateRefElementWrapper>( |
| 14 const [const Binding('ref')]); |
| 15 |
| 16 static const tag = const Tag<IsolateRefElementWrapper>('isolate-ref'); |
| 17 |
| 18 Isolate _ref; |
| 19 Isolate get ref => _ref; |
| 20 void set ref(Isolate ref) { _ref = ref; render();} |
| 21 |
| 22 IsolateRefElementWrapper.created() : super.created() { |
| 23 binder.registerCallback(this); |
| 24 createShadowRoot(); |
| 25 render(); |
| 26 } |
| 27 |
| 28 @override |
| 29 void attached() { |
| 30 super.attached(); |
| 31 render(); |
| 32 } |
| 33 |
| 34 void render() { |
| 35 shadowRoot.children = []; |
| 36 if (ref == null) return; |
| 37 |
| 38 shadowRoot.children = [ |
| 39 new IsolateRefElement(isolate: _ref) |
| 40 ]; |
| 41 } |
| 42 } |
OLD | NEW |