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

Side by Side Diff: pkg/barback/lib/src/node_streams.dart

Issue 249183005: Move common streams in barback to their own class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « pkg/barback/lib/src/group_runner.dart ('k') | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 library barback.node_streams;
6
7 import 'dart:async';
8
9 import 'asset_node.dart';
10 import 'log.dart';
11 import 'stream_pool.dart';
12
13 /// A collection of streams that are common to nodes in barback's package graph.
14 class NodeStreams {
15 /// A stream that emits an event whenever the node is no longer dirty.
16 ///
17 /// This is synchronous in order to guarantee that it will emit an event as
18 /// soon as [isDirty] flips from `true` to `false`.
19 Stream get onDone => onDoneController.stream;
20 final onDoneController = new StreamController.broadcast(sync: true);
21
22 /// A stream that emits any new assets produced by the node.
23 ///
24 /// Assets are emitted synchronously to ensure that any changes are thoroughly
25 /// propagated as soon as they occur.
26 Stream<AssetNode> get onAsset => onAssetPool.stream;
27 final onAssetPool = new StreamPool<AssetNode>.broadcast();
28 final onAssetController =
29 new StreamController<AssetNode>.broadcast(sync: true);
30
31 /// A stream that emits an event whenever any the node logs an entry.
32 Stream<LogEntry> get onLog => onLogPool.stream;
33 final onLogPool = new StreamPool<LogEntry>.broadcast();
34 final onLogController = new StreamController<LogEntry>.broadcast(sync: true);
35
36 NodeStreams() {
37 onAssetPool.add(onAssetController.stream);
38 onLogPool.add(onLogController.stream);
39 }
40
41 /// Closes all the streams.
42 void close() {
43 onDoneController.close();
44 onAssetController.close();
45 onAssetPool.close();
46 onLogController.close();
47 onLogPool.close();
48 }
49 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/group_runner.dart ('k') | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698