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

Side by Side Diff: runtime/observatory/lib/src/repositories/notification.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 part of repositories;
6
7 class NotificationChangeEvent implements M.NotificationChangeEvent {
8 final NotificationRepository repository;
9 NotificationChangeEvent(this.repository);
10 }
11
12 class NotificationRepository implements M.NotificationRepository {
13 final List<M.Notification> _list = new List<M.Notification>();
14
15 final StreamController<M.NotificationChangeEvent> _onChange;
16 final Stream<M.NotificationChangeEvent> onChange;
17
18 void add(M.Notification notification) {
19 _list.add(notification);
20 _onChange.add(new NotificationChangeEvent(this));
21 }
22
23 Iterable<M.Notification> list() => _list;
24
25 void delete(M.Notification notification) {
26 if (_list.remove(notification))
27 _onChange.add(new NotificationChangeEvent(this));
28 }
29
30 void deleteAll() {
31 if (_list.isNotEmpty) {
32 _list.clear();
33 _onChange.add(new NotificationChangeEvent(this));
34 }
35 }
36
37 factory NotificationRepository() {
38 var controller = new StreamController<M.NotificationChangeEvent>();
39 var stream = controller.stream.asBroadcastStream();
40 return new NotificationRepository._(controller, stream);
41 }
42 NotificationRepository._(this._onChange, this.onChange);
43 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/models/repository.dart ('k') | runtime/observatory/lib/src/repositories/script.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698