blob: 578b645926b4a946bac8b358549fe6af59202072 [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
factory $CLASSNAME(String type, {
Window view,
bool canBubble: true,
bool cancelable: true,
int location,
int keyLocation, // Legacy alias for location
bool ctrlKey: false,
bool altKey: false,
bool shiftKey: false,
bool metaKey: false}) {
if (view == null) {
view = window;
}
location ??= keyLocation ?? 1;
final e = document._createEvent("KeyboardEvent");
e._initKeyboardEvent(type, canBubble, cancelable, view, "",
location, ctrlKey, altKey, shiftKey, metaKey);
return e;
}
@DomName('KeyboardEvent.keyCode')
int get keyCode => _keyCode;
@DomName('KeyboardEvent.charCode')
int get charCode => _charCode;
@DomName('KeyboardEvent.which')
int get which => _which;
$!MEMBERS
}