pencil.js
Version:
Nice modular interactive 2D drawing library.
64 lines (63 loc) • 2.17 kB
TypeScript
/**
* @module KeyboardEvent
*/
/**
* Keyboard event class
* @class
* @extends BaseEvent
*/
export default class KeyboardEvent extends BaseEvent {
/**
* @typedef {Object} KeyboardEvents
* @enum {String}
* @prop {String} down - Keyboard key pressed
* @prop {String} up - Keyboard key released
*/
/**
* Set of supported event name for easy access
* @example component.on(KeyboardEvent.events.up, () => console.log("User release a key"));
* @type {KeyboardEvents}
*/
static get events(): any;
/**
* @typedef {Object} ArrowKeys
* @enum {String}
* @prop {String} up - Up arrow
* @prop {String} right - Right arrow
* @prop {String} down - Down arrow
* @prop {String} left - Left arrow
*/
/**
* @typedef {Object} KeyboardKeys
* @enum {String}
* @prop {String} backspace - Remove last character or return previous screen
* @prop {String} enter - Add line-break or validate entry
* @prop {String} delete - Remove character in front
* @prop {String} escape - Cancel or leave screen
* @prop {String} control - Modifying key (control)
* @prop {String} shift - Modifying key (uppercase)
* @prop {String} fn - Modifying key (function)
* @prop {ArrowKeys}
* @prop {String} tab - Next input or toggle focus
* @prop {String} alt - Modifying key (alternative)
* @prop {String} altGr - Modifying key (alternative grapheme)
* @prop {String} pageUp - Move up one page
* @prop {String} pageDown - Move down one page
* @prop {String} start - Go to start
* @prop {String} end - Go to end
* @prop {String} insert - Insert here or toggle insert mode
*/
/**
* Set of keys for easy access
* @example if (key === KeyboardEvent.keys.enter) {
* console.log("This is the enter key");
* }
* @type {KeyboardKeys}
*/
static get keys(): any;
key: any;
}
export type KeyboardEvents = any;
export type ArrowKeys = any;
export type KeyboardKeys = any;
import BaseEvent from "@pencil.js/base-event";