Skip to content

Commit 9ab262c

Browse files
O4epegbjukben
authored andcommitted
Fix listener index increment (#136)
1 parent 0bfe830 commit 9ab262c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/listener.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Listener {
2323
f: Function;
2424

2525
constructor() {
26-
this.index = 0;
26+
this.index = 1;
2727
this.listeners = {};
2828

2929
this.f = (e: KeyboardEvent) => {
@@ -62,9 +62,7 @@ class Listener {
6262
fn
6363
};
6464

65-
this.index += 1;
66-
67-
return this.index;
65+
return this.index++;
6866
};
6967

7068
remove = (id: number) => {
@@ -73,7 +71,7 @@ class Listener {
7371

7472
removeAll = () => {
7573
this.listeners = {};
76-
this.index = 0;
74+
this.index = 1;
7775
};
7876
}
7977

0 commit comments

Comments
 (0)