mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 14:43:33 +03:00
fec189f2f3
bundler: - Prevent stack overflow. (denoland/deno#9752) testing: - Bump version - Fix handling of paths on windows. testing_macros: - Bump version - Correctly ignore files.
37 lines
738 B
TypeScript
37 lines
738 B
TypeScript
// Loaded from https://deno.land/x/cliffy@v0.18.0/keycode/key_event.ts
|
|
|
|
|
|
/** KeyEvent options. */
|
|
export interface IKey {
|
|
name?: string;
|
|
sequence?: string;
|
|
ctrl: boolean;
|
|
meta: boolean;
|
|
shift: boolean;
|
|
}
|
|
|
|
/** KeyEvent representation. */
|
|
export class KeyEvent {
|
|
protected constructor(
|
|
public readonly name: string | undefined,
|
|
public readonly sequence: string | undefined,
|
|
public readonly ctrl = false,
|
|
public readonly meta = false,
|
|
public readonly shift = false,
|
|
) {}
|
|
|
|
/**
|
|
* Create new KeyEvent.
|
|
* @param key KeyEvent options.
|
|
*/
|
|
public static from(key: IKey): KeyEvent {
|
|
return new this(
|
|
key.name,
|
|
key.sequence,
|
|
key.ctrl,
|
|
key.meta,
|
|
key.shift,
|
|
);
|
|
}
|
|
}
|