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

Side by Side Diff: tools/dom/src/KeyboardEventStream.dart

Issue 14136004: Remove StreamController.broadcast. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 /** 7 /**
8 * Internal class that does the actual calculations to determine keyCode and 8 * Internal class that does the actual calculations to determine keyCode and
9 * charCode for keydown, keypress, and keyup events for all browsers. 9 * charCode for keydown, keypress, and keyup events for all browsers.
10 */ 10 */
(...skipping 10 matching lines...) Expand all
21 /** The type of KeyEvent we are tracking (keyup, keydown, keypress). */ 21 /** The type of KeyEvent we are tracking (keyup, keydown, keypress). */
22 final String _type; 22 final String _type;
23 23
24 /** The element we are watching for events to happen on. */ 24 /** The element we are watching for events to happen on. */
25 final EventTarget _target; 25 final EventTarget _target;
26 26
27 // The distance to shift from upper case alphabet Roman letters to lower case. 27 // The distance to shift from upper case alphabet Roman letters to lower case.
28 static final int _ROMAN_ALPHABET_OFFSET = "a".codeUnits[0] - "A".codeUnits[0]; 28 static final int _ROMAN_ALPHABET_OFFSET = "a".codeUnits[0] - "A".codeUnits[0];
29 29
30 /** Controller to produce KeyEvents for the stream. */ 30 /** Controller to produce KeyEvents for the stream. */
31 final StreamController _controller = new StreamController.broadcast(); 31 final StreamController _controller = new StreamController();
32 32
33 static const _EVENT_TYPE = 'KeyEvent'; 33 static const _EVENT_TYPE = 'KeyEvent';
34 34
35 /** 35 /**
36 * An enumeration of key identifiers currently part of the W3C draft for DOM3 36 * An enumeration of key identifiers currently part of the W3C draft for DOM3
37 * and their mappings to keyCodes. 37 * and their mappings to keyCodes.
38 * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set 38 * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set
39 */ 39 */
40 static const Map<String, int> _keyIdentifier = const { 40 static const Map<String, int> _keyIdentifier = const {
41 'Up': KeyCode.UP, 41 'Up': KeyCode.UP,
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 new _KeyboardEventHandler('keypress').forTarget(target); 395 new _KeyboardEventHandler('keypress').forTarget(target);
396 396
397 /** Named constructor to produce a stream for onKeyUp events. */ 397 /** Named constructor to produce a stream for onKeyUp events. */
398 static Stream<KeyEvent> onKeyUp(EventTarget target) => 398 static Stream<KeyEvent> onKeyUp(EventTarget target) =>
399 new _KeyboardEventHandler('keyup').forTarget(target); 399 new _KeyboardEventHandler('keyup').forTarget(target);
400 400
401 /** Named constructor to produce a stream for onKeyDown events. */ 401 /** Named constructor to produce a stream for onKeyDown events. */
402 static Stream<KeyEvent> onKeyDown(EventTarget target) => 402 static Stream<KeyEvent> onKeyDown(EventTarget target) =>
403 new _KeyboardEventHandler('keydown').forTarget(target); 403 new _KeyboardEventHandler('keydown').forTarget(target);
404 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698