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

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

Issue 2211603002: Centralized event streams (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with master Created 4 years, 4 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
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:observatory/models.dart' as M; 7 import 'package:observatory/models.dart' as M;
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 import 'package:observatory/src/elements/helpers/tag.dart'; 9 import 'package:observatory/src/elements/helpers/tag.dart';
10 import 'package:observatory/src/elements/helpers/uris.dart'; 10 import 'package:observatory/src/elements/helpers/uris.dart';
11 11
12 class EventDeleteEvent{ 12 class EventDeleteEvent{
13 final M.Event event; 13 final M.Event event;
14 EventDeleteEvent(this.event); 14 EventDeleteEvent(this.event);
15 } 15 }
16 16
17 class NavNotifyEventElement extends HtmlElement implements Renderable { 17 class NavNotifyEventElement extends HtmlElement implements Renderable {
18 static const tag = const Tag<NavNotifyEventElement>('nav-event'); 18 static const tag = const Tag<NavNotifyEventElement>('nav-event');
19 19
20 RenderingScheduler _r; 20 RenderingScheduler _r;
21 21
22 Stream<RenderedEvent<NavNotifyEventElement>> get onRendered => _r.onRendered; 22 Stream<RenderedEvent<NavNotifyEventElement>> get onRendered => _r.onRendered;
23 23
24 final StreamController<EventDeleteEvent> _onDelete = 24 final StreamController<EventDeleteEvent> _onDelete =
25 new StreamController<EventDeleteEvent>.broadcast(); 25 new StreamController<EventDeleteEvent>.broadcast();
26 Stream<EventDeleteEvent> get onDelete => _onDelete.stream; 26 Stream<EventDeleteEvent> get onDelete => _onDelete.stream;
27 27
28 M.Event _event; 28 M.Event _event;
29
29 M.Event get event => _event; 30 M.Event get event => _event;
30 31
31 factory NavNotifyEventElement(M.Event event, {RenderingQueue queue}) { 32 factory NavNotifyEventElement(M.Event event, {RenderingQueue queue}) {
32 assert(event != null); 33 assert(event != null);
33 NavNotifyEventElement e = document.createElement(tag.name); 34 NavNotifyEventElement e = document.createElement(tag.name);
34 e._r = new RenderingScheduler(e, queue: queue); 35 e._r = new RenderingScheduler(e, queue: queue);
35 e._event = event; 36 e._event = event;
36 return e; 37 return e;
37 } 38 }
38 39
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 224 }
224 225
225 void _delete(EventDeleteEvent e) { 226 void _delete(EventDeleteEvent e) {
226 _onDelete.add(e); 227 _onDelete.add(e);
227 } 228 }
228 229
229 void delete() { 230 void delete() {
230 _onDelete.add(new EventDeleteEvent(_event)); 231 _onDelete.add(new EventDeleteEvent(_event));
231 } 232 }
232 } 233 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/notify.dart ('k') | runtime/observatory/lib/src/elements/nav/notify_exception.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698