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

Side by Side Diff: lib/src/delegates.dart

Issue 1149563010: Add new features to package:async. (Closed) Base URL: https://github.com/dart-lang/async@master
Patch Set: more docs and tests. Created 5 years, 6 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) 2015, 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 async.streams.delegates;
nweiz 2015/06/12 01:24:22 Library annotations should match the path to the l
Lasse Reichstein Nielsen 2015/06/12 13:04:19 Without the "src" I assume. I originally expected
nweiz 2015/06/16 01:05:22 They matter exactly inasmuch as tools will complai
6
7 import 'dart:async';
8
9 /// Simple delegating wrapper around a [StreamSubscription].
10 ///
11 /// Subclasses can override individual methods.
12 class DelegatingStreamSubscription<T> implements StreamSubscription<T> {
13 final StreamSubscription _source;
14
15 DelegatingStreamSubscription(StreamSubscription subscription)
16 : _source = subscription;
17
18 void onData(void handleData(T data)) {
19 _source.onData(handleData);
20 }
21
22 void onError(Function handleError) {
23 _source.onError(handleError);
24 }
25
26 void onDone(void handleDone()) {
27 _source.onDone(handleDone);
28 }
29
30 void pause([Future resumeFuture]) {
31 _source.pause(resumeFuture);
32 }
33
34 void resume() {
35 _source.resume();
36 }
37
38 Future cancel() {
39 return _source.cancel();
40 }
41
42 Future asFuture([futureValue]) {
43 return _source.asFuture(futureValue);
44 }
45
46 bool get isPaused => _source.isPaused;
47 }
OLDNEW
« no previous file with comments | « lib/async.dart ('k') | lib/src/stream_completer.dart » ('j') | lib/src/stream_completer.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698