OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 part of $LIBRARYNAME; | |
5 | |
6 | |
7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | |
8 | |
9 factory $CLASSNAME(String type, { | |
10 Window view, | |
11 bool canBubble: true, | |
12 bool cancelable: true, | |
13 int location, | |
14 int keyLocation, // Legacy alias for location | |
15 bool ctrlKey: false, | |
16 bool altKey: false, | |
17 bool shiftKey: false, | |
18 bool metaKey: false}) { | |
19 if (view == null) { | |
20 view = window; | |
21 } | |
22 location ??= keyLocation ?? 1; | |
23 final e = document._createEvent("KeyboardEvent"); | |
24 e._initKeyboardEvent(type, canBubble, cancelable, view, "", | |
25 location, ctrlKey, altKey, shiftKey, metaKey); | |
26 return e; | |
27 } | |
28 | |
29 @DomName('KeyboardEvent.keyCode') | |
30 int get keyCode => _keyCode; | |
31 | |
32 @DomName('KeyboardEvent.charCode') | |
33 int get charCode => _charCode; | |
34 | |
35 @DomName('KeyboardEvent.which') | |
36 int get which => _which; | |
37 $!MEMBERS | |
38 } | |
OLD | NEW |