| OLD | NEW |
| 1 /** | 1 /** |
| 2 * A custom KeyboardEvent that attempts to eliminate cross-browser | 2 * A custom KeyboardEvent that attempts to eliminate cross-browser |
| 3 * inconsistencies, and also provide both keyCode and charCode information | 3 * inconsistencies, and also provide both keyCode and charCode information |
| 4 * for all key events (when such information can be determined). | 4 * for all key events (when such information can be determined). |
| 5 * | 5 * |
| 6 * KeyEvent tries to provide a higher level, more polished keyboard event | 6 * KeyEvent tries to provide a higher level, more polished keyboard event |
| 7 * information on top of the "raw" [KeyboardEvent]. | 7 * information on top of the "raw" [KeyboardEvent]. |
| 8 * | 8 * |
| 9 * The mechanics of using KeyEvents is a little different from the underlying |
| 10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add |
| 11 * KeyEvents to the stream, rather than using the [EventTarget.dispatchEvent]. |
| 12 * Here's an example usage: |
| 13 * |
| 14 * // Initialize a stream for the KeyEvents: |
| 15 * var stream = KeyEvent.keyPressEvent.forTarget(document.body); |
| 16 * // Start listening to the stream of KeyEvents. |
| 17 * stream.listen((keyEvent) => |
| 18 * window.console.log('KeyPress event detected ${keyEvent.charCode}')); |
| 19 * ... |
| 20 * // Add a new KeyEvent of someone pressing the 'A' key to the stream so |
| 21 * // listeners can know a KeyEvent happened. |
| 22 * stream.add(new KeyEvent('keypress', keyCode: 65, charCode: 97)); |
| 23 * |
| 9 * This class is very much a work in progress, and we'd love to get information | 24 * This class is very much a work in progress, and we'd love to get information |
| 10 * on how we can make this class work with as many international keyboards as | 25 * on how we can make this class work with as many international keyboards as |
| 11 * possible. Bugs welcome! | 26 * possible. Bugs welcome! |
| 12 */ | 27 */ |
| 13 part of html; | 28 part of html; |
| 14 | 29 |
| 15 @Experimental() | 30 @Experimental() |
| 16 class KeyEvent extends _WrappedEvent implements KeyboardEvent { | 31 class KeyEvent extends _WrappedEvent implements KeyboardEvent { |
| 17 /** The parent KeyboardEvent that this KeyEvent is wrapping and "fixing". */ | 32 /** The parent KeyboardEvent that this KeyEvent is wrapping and "fixing". */ |
| 18 KeyboardEvent _parent; | 33 KeyboardEvent _parent; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent'); | 149 int get _pageX => throw new UnsupportedError('Not applicable to KeyEvent'); |
| 135 int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent'); | 150 int get _pageY => throw new UnsupportedError('Not applicable to KeyEvent'); |
| 136 @Experimental() // untriaged | 151 @Experimental() // untriaged |
| 137 bool getModifierState(String keyArgument) => throw new UnimplementedError(); | 152 bool getModifierState(String keyArgument) => throw new UnimplementedError(); |
| 138 @Experimental() // untriaged | 153 @Experimental() // untriaged |
| 139 int get location => throw new UnimplementedError(); | 154 int get location => throw new UnimplementedError(); |
| 140 @Experimental() // untriaged | 155 @Experimental() // untriaged |
| 141 bool get repeat => throw new UnimplementedError(); | 156 bool get repeat => throw new UnimplementedError(); |
| 142 dynamic get _get_view => throw new UnimplementedError(); | 157 dynamic get _get_view => throw new UnimplementedError(); |
| 143 } | 158 } |
| OLD | NEW |