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

Unified Diff: tools/dom/src/EventStreamProvider.dart

Issue 26334002: "Reverting 28321" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/keyboard_event_test.dart ('k') | tools/dom/src/KeyCode.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/EventStreamProvider.dart
diff --git a/tools/dom/src/EventStreamProvider.dart b/tools/dom/src/EventStreamProvider.dart
index 55bf8b90ae93e96a1a43d6fd1f35721ea6209177..bd6e04ca6e2cffbeae0845d50360ae6f00e652f4 100644
--- a/tools/dom/src/EventStreamProvider.dart
+++ b/tools/dom/src/EventStreamProvider.dart
@@ -90,61 +90,6 @@ class _ElementListEventStreamImpl<T extends Event> extends Stream<T>
}
/**
- * A stream of custom events, which enables the user to "fire" (add) their own
- * custom events to a stream.
- */
-abstract class CustomStream<T extends Event> implements Stream<T> {
- /**
- * Add the following custom event to the stream for dispatching to interested
- * listeners.
- */
- void add(T event);
-}
-
-class _CustomEventStreamImpl<T extends Event> extends Stream<T>
- implements CustomStream<T> {
- StreamController<T> _streamController;
- /** The type of event this stream is providing (e.g. "keydown"). */
- String _type;
-
- _CustomEventStreamImpl(String type) {
- _type = type;
- _streamController = new StreamController.broadcast(sync: true);
- }
-
- // Delegate all regular Stream behavior to our wrapped Stream.
- StreamSubscription<T> listen(void onData(T event),
- { void onError(error),
- void onDone(),
- bool cancelOnError}) {
- return _streamController.stream.listen(onData, onError: onError,
- onDone: onDone, cancelOnError: cancelOnError);
- }
-
- Stream<T> asBroadcastStream({void onListen(StreamSubscription subscription),
- void onCancel(StreamSubscription subscription)})
- => _streamController.stream;
-
- bool get isBroadcast => true;
-
- void add(T event) {
- if (event.type == _type) _streamController.add(event);
- }
-}
-
-class _CustomKeyEventStreamImpl extends _CustomEventStreamImpl<KeyEvent>
- implements CustomStream<KeyEvent> {
- _CustomKeyEventStreamImpl(String type) : super(type);
-
- void add(KeyEvent event) {
- if (event.type == _type) {
- event.currentTarget.dispatchEvent(event._parent);
- _streamController.add(event);
- }
- }
-}
-
-/**
* A pool of streams whose events are unified and emitted through a central
* stream.
*/
« no previous file with comments | « tests/html/keyboard_event_test.dart ('k') | tools/dom/src/KeyCode.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698