| Index: runtime/observatory/lib/src/elements/nav/notify_wrapper.dart
|
| diff --git a/runtime/observatory/lib/src/elements/nav/notify_wrapper.dart b/runtime/observatory/lib/src/elements/nav/notify_wrapper.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7dee360124b35ad10df1a274f00471d36fce9e44
|
| --- /dev/null
|
| +++ b/runtime/observatory/lib/src/elements/nav/notify_wrapper.dart
|
| @@ -0,0 +1,53 @@
|
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +import 'dart:html';
|
| +
|
| +import 'package:observatory/app.dart';
|
| +import 'package:observatory/repositories.dart';
|
| +import 'package:observatory/src/elements/helpers/tag.dart';
|
| +import 'package:observatory/src/elements/shims/binding.dart';
|
| +import 'package:observatory/src/elements/nav/notify.dart';
|
| +
|
| +class NavNotifyElementWrapper extends HtmlElement {
|
| + static final binder = new Binder<NavNotifyElementWrapper>(
|
| + const [const Binding('notifications'), const Binding('notifyOnPause')]);
|
| +
|
| + static const tag = const Tag<NavNotifyElementWrapper>('nav-notify');
|
| +
|
| + NotificationRepository _notifications;
|
| + bool _notifyOnPause = true;
|
| + NotificationRepository get notifications => _notifications;
|
| + bool get notifyOnPause => _notifyOnPause;
|
| + set notifications(NotificationRepository notifications) {
|
| + _notifications = notifications; render();
|
| + }
|
| + set notifyOnPause(bool notifyOnPause) {
|
| + _notifyOnPause = notifyOnPause; render();
|
| + }
|
| +
|
| + NavNotifyElementWrapper.created() : super.created() {
|
| + binder.registerCallback(this);
|
| + createShadowRoot();
|
| + render();
|
| + }
|
| +
|
| + @override
|
| + void attached() {
|
| + super.attached();
|
| + render();
|
| + }
|
| +
|
| + void render() {
|
| + shadowRoot.children = [];
|
| + if (_notifications == null) return;
|
| +
|
| + shadowRoot.children = [
|
| + new StyleElement()
|
| + ..text = '@import "packages/observatory/src/elements/css/shared.css";',
|
| + new NavNotifyElement(_notifications, notifyOnPause: notifyOnPause,
|
| + queue: ObservatoryApplication.app.queue)
|
| + ];
|
| + }
|
| +}
|
|
|