Skip to content

Commit

Permalink
feat(keypress): add char property to KeyPressEvent (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar authored Dec 2, 2022
1 parent 94fa06b commit 0b655c7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions keypress/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type KeyPressEventType = "keydown";

interface KeyCodeOptions {
name?: string;
char?: string;
sequence?: string;
code?: string;
ctrl?: boolean;
Expand All @@ -29,6 +30,7 @@ export type KeyPressEventListenerOrEventListenerObject =

export class KeyPressEvent extends Event {
public readonly key?: string;
public readonly char?: string;
public readonly sequence?: string;
public readonly code?: string;
public readonly ctrlKey: boolean;
Expand All @@ -43,6 +45,7 @@ export class KeyPressEvent extends Event {
) {
super(type, eventInitDict);
this.key = eventInitDict.name;
this.char = eventInitDict.char;
this.sequence = eventInitDict.sequence;
this.code = eventInitDict.code;
this.ctrlKey = eventInitDict.ctrl ?? false;
Expand Down

0 comments on commit 0b655c7

Please sign in to comment.