starling-framework
Version:
A fast, productive library for 2D cross-platform development.
66 lines • 2.18 kB
TypeScript
import Event from "./Event";
declare namespace starling.events {
/**
* A KeyboardEvent is dispatched in response to user input through a keyboard.
* *
* * <p>This is Starling's version of the Flash KeyboardEvent class. It contains the same
* * properties as the Flash equivalent.</p>
* *
* * <p>To be notified of keyboard events, add an event listener to any display object that
* * is part of your display tree. Starling has no concept of a "Focus" like native Flash.</p>
* *
* * @see starling.display.Stage
*
*/
export class KeyboardEvent extends Event {
/**
* Creates a new KeyboardEvent.
*/
constructor(type: string, charCode?: number, keyCode?: number, keyLocation?: number, ctrlKey?: boolean, altKey?: boolean, shiftKey?: boolean);
/**
* Event type for a key that was released.
*/
static readonly KEY_UP = "keyUp";
/**
* Event type for a key that was pressed.
*/
static readonly KEY_DOWN = "keyDown";
/**
* Cancels the keyboard event's default behavior. This will be forwarded to the native
* * flash KeyboardEvent.
*/
preventDefault(): void;
/**
* Checks whether the preventDefault() method has been called on the event.
*/
isDefaultPrevented(): boolean;
/**
* Contains the character code of the key.
*/
get charCode(): number;
/**
* The key code of the key.
*/
get keyCode(): number;
/**
* Indicates the location of the key on the keyboard. This is useful for differentiating
* * keys that appear more than once on a keyboard. @see Keylocation
*/
get keyLocation(): number;
/**
* Indicates whether the Alt key is active on Windows or Linux;
* * indicates whether the Option key is active on Mac OS.
*/
get altKey(): boolean;
/**
* Indicates whether the Ctrl key is active on Windows or Linux;
* * indicates whether either the Ctrl or the Command key is active on Mac OS.
*/
get ctrlKey(): boolean;
/**
* Indicates whether the Shift key modifier is active (true) or inactive (false).
*/
get shiftKey(): boolean;
}
}
export default starling.events.KeyboardEvent;