swc/crates/swc_bundler/tests/.cache/deno/9e4379f4cc4c4c34835c657349213a5a6b3e5630.ts
2021-11-09 20:42:49 +09:00

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,
);
}
}