| Index: sdk/lib/html/dart2js/html_dart2js.dart
|
| diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
|
| index 9d5bddf87dbc07514a03bd5efe601b28e087f041..84c035fae88d61ca3390860cd830a636186d1944 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -30560,6 +30560,42 @@ class EventStreamProvider<T extends Event> {
|
| Stream<T> forTarget(EventTarget e, {bool useCapture: false}) {
|
| return new _EventStream(e, _eventType, useCapture);
|
| }
|
| +
|
| + /**
|
| + * Gets a single event [Stream] which is the combinations of event streams
|
| + * for this event for each target.
|
| + *
|
| + * See also:
|
| + *
|
| + * * [forTarget]
|
| + */
|
| + Stream<T> forTargets(List<EventTarget> targets, {bool useCapture: false}) {
|
| + // Clone so modifications to the list don't affect this.
|
| + targets = new List.from(targets);
|
| +
|
| + // Keep track of subscriptions so we unsubscribe from all when the stream
|
| + // we return is unsubscribed.
|
| + var subscriptions = [];
|
| + var controller;
|
| + controller = new StreamController<T>(onSubscriptionStateChange: () {
|
| + if (controller.hasSubscribers) {
|
| + assert(subscriptions.isEmpty);
|
| + for (var target in targets) {
|
| + subscriptions.add(forTarget(target, useCapture: useCapture).listen(
|
| + (e) {
|
| + controller.add(e);
|
| + }));
|
| + }
|
| + } else {
|
| + assert(subscriptions.length == targets.length);
|
| + for (var subscription in subscriptions) {
|
| + subscription.cancel();
|
| + }
|
| + subscriptions.clear();
|
| + }
|
| + });
|
| + return controller.stream;
|
| + }
|
| }
|
|
|
| /**
|
|
|