| Index: tools/dom/src/dart2js_KeyEvent.dart
|
| diff --git a/tools/dom/src/dart2js_KeyEvent.dart b/tools/dom/src/dart2js_KeyEvent.dart
|
| index f3be576c6e5379c72a87ae44f5ff9b28a4117209..e8124e043b1a132230be77ce6db3287649604d40 100644
|
| --- a/tools/dom/src/dart2js_KeyEvent.dart
|
| +++ b/tools/dom/src/dart2js_KeyEvent.dart
|
| @@ -6,6 +6,21 @@
|
| * KeyEvent tries to provide a higher level, more polished keyboard event
|
| * information on top of the "raw" [KeyboardEvent].
|
| *
|
| + * The mechanics of using KeyEvents is a little different from the underlying
|
| + * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add
|
| + * KeyEvents to the stream, rather than using the [EventTarget.dispatchEvent].
|
| + * Here's an example usage:
|
| + *
|
| + * // Initialize a stream for the KeyEvents:
|
| + * var stream = KeyEvent.keyPressEvent.forTarget(document.body);
|
| + * // Start listening to the stream of KeyEvents.
|
| + * stream.listen((keyEvent) =>
|
| + * window.console.log('KeyPress event detected ${keyEvent.charCode}'));
|
| + * ...
|
| + * // Add a new KeyEvent of someone pressing the 'A' key to the stream so
|
| + * // listeners can know a KeyEvent happened.
|
| + * stream.add(new KeyEvent('keypress', keyCode: 65, charCode: 97));
|
| + *
|
| * This class is very much a work in progress, and we'd love to get information
|
| * on how we can make this class work with as many international keyboards as
|
| * possible. Bugs welcome!
|
|
|