Index: runtime/observatory/lib/src/elements/nav/isolate_menu.dart |
diff --git a/runtime/observatory/lib/src/elements/nav/isolate_menu.dart b/runtime/observatory/lib/src/elements/nav/isolate_menu.dart |
index 3f0089ad33b5087864c74e46394f7ca9fd1c9ad8..d9f82c904f24615c6f229589b8fed47a5e015968 100644 |
--- a/runtime/observatory/lib/src/elements/nav/isolate_menu.dart |
+++ b/runtime/observatory/lib/src/elements/nav/isolate_menu.dart |
@@ -5,7 +5,7 @@ |
import 'dart:html'; |
import 'dart:async'; |
import 'package:observatory/models.dart' as M |
- show IsolateRef, IsolateUpdateEvent; |
+ show IsolateRef, EventRepository; |
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
import 'package:observatory/src/elements/helpers/tag.dart'; |
import 'package:observatory/src/elements/helpers/uris.dart'; |
@@ -21,25 +21,27 @@ class NavIsolateMenuElement extends HtmlElement implements Renderable { |
Stream<RenderedEvent<NavIsolateMenuElement>> get onRendered => _r.onRendered; |
- Stream<M.IsolateUpdateEvent> _updates; |
- StreamSubscription _updatesSubscription; |
- |
bool _last; |
M.IsolateRef _isolate; |
+ M.EventRepository _events; |
+ StreamSubscription _updatesSubscription; |
+ |
bool get last => _last; |
M.IsolateRef get isolate => _isolate; |
+ |
set last(bool value) => _last = _r.checkAndReact(_last, value); |
factory NavIsolateMenuElement(M.IsolateRef isolate, |
- Stream<M.IsolateUpdateEvent> updates, {bool last: false, |
+ M.EventRepository events, {bool last: false, |
RenderingQueue queue}) { |
assert(isolate != null); |
+ assert(events != null); |
assert(last != null); |
NavIsolateMenuElement e = document.createElement(tag.name); |
e._r = new RenderingScheduler(e, queue: queue); |
e._isolate = isolate; |
e._last = last; |
- e._updates = updates; |
+ e._events = events; |
return e; |
} |
@@ -51,12 +53,10 @@ class NavIsolateMenuElement extends HtmlElement implements Renderable { |
@override |
void attached() { |
super.attached(); |
- assert(_isolate != null); |
- assert(_updates != null); |
+ _updatesSubscription = _events.onIsolateUpdate |
+ .where((e) => e.isolate.id == isolate.id) |
+ .listen((e) { _isolate = e.isolate; _r.dirty(); }); |
_r.enable(); |
- _updatesSubscription = _updates |
- .where((M.IsolateUpdateEvent e) => e.isolate.id == isolate.id) |
- .listen((M.IsolateUpdateEvent e) { _isolate = e.isolate; _r.dirty(); }); |
} |
@override |