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

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

Issue 2119733003: Wrapping leaf nodes in non polymer elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted vm-connect Created 4 years, 5 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
(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/repositories.dart';
9 import 'package:observatory/src/elements/helpers/tag.dart';
10 import 'package:observatory/src/elements/shims/binding.dart';
11 import 'package:observatory/src/elements/nav/notify.dart';
12
13 class NavNotifyElementWrapper extends HtmlElement {
14 static final binder = new Binder<NavNotifyElementWrapper>(
15 const [const Binding('notifications'), const Binding('notifyOnPause')]);
16
17 static const tag = const Tag<NavNotifyElementWrapper>('nav-notify');
18
19 NotificationRepository _notifications;
20 bool _notifyOnPause = true;
21 NotificationRepository get notifications => _notifications;
22 bool get notifyOnPause => _notifyOnPause;
23 set notifications(NotificationRepository notifications) {
24 _notifications = notifications; render();
25 }
26 set notifyOnPause(bool notifyOnPause) {
27 _notifyOnPause = notifyOnPause; render();
28 }
29
30 NavNotifyElementWrapper.created() : super.created() {
31 binder.registerCallback(this);
32 createShadowRoot();
33 render();
34 }
35
36 @override
37 void attached() {
38 super.attached();
39 render();
40 }
41
42 void render() {
43 shadowRoot.children = [];
44 if (_notifications == null) return;
45
46 shadowRoot.children = [
47 new StyleElement()
48 ..text = '@import "packages/observatory/src/elements/css/shared.css";',
49 new NavNotifyElement(_notifications, notifyOnPause: notifyOnPause,
50 queue: ObservatoryApplication.app.queue)
51 ];
52 }
53 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/notify_exception.dart ('k') | runtime/observatory/lib/src/elements/nav/refresh.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698