OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'dart:html'; | |
6 | |
7 import 'package:observatory/app.dart'; | |
8 import 'package:observatory/src/elements/helpers/tag.dart'; | |
9 import 'package:observatory/src/elements/shims/binding.dart'; | |
10 import 'package:observatory/src/elements/nav/top_menu.dart'; | |
11 | |
12 class NavTopMenuElementWrapper extends HtmlElement { | |
13 static final binder = new Binder<NavTopMenuElementWrapper>( | |
14 const [const Binding('last')]); | |
15 | |
16 static const tag = const Tag<NavTopMenuElementWrapper>('top-nav-menu'); | |
17 | |
18 bool _last = false; | |
19 bool get last => _last; | |
20 set last(bool value) { | |
21 _last = value; render(); | |
22 } | |
23 | |
24 NavTopMenuElementWrapper.created() : super.created() { | |
25 binder.registerCallback(this); | |
26 _last = getAttribute('') != null; | |
Cutch
2016/07/20 13:50:45
what is this checking?
cbernaschina
2016/07/20 17:17:00
It is checking the presence of the attribute.
If i
cbernaschina
2016/07/20 17:56:12
Done.
| |
27 createShadowRoot(); | |
28 render(); | |
29 } | |
30 | |
31 @override | |
32 void attached() { | |
33 super.attached(); | |
34 render(); | |
35 } | |
36 | |
37 void render() { | |
38 shadowRoot.children = []; | |
39 if (_last == null) return; | |
40 | |
41 shadowRoot.children = [ | |
42 new NavTopMenuElement(last: last, queue: ObservatoryApplication.app.queue) | |
43 ..children = [new ContentElement()] | |
44 ]; | |
45 } | |
46 } | |
OLD | NEW |