Skip to content

Commit

Permalink
尝试捕获输入事件回调错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-xmh committed Mar 23, 2024
1 parent 43d3e31 commit 3c8a8b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/keybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ window.addEventListener("keyup", (evt) => {
downTimeOffset,
};
for (const cb of callbacks) {
cb(e);
try {
cb(e);
} catch (err) {
console.warn("Error in key binding ", joined, "callback", err);
}
}
evt.preventDefault();
evt.stopPropagation();
Expand Down

0 comments on commit 3c8a8b0

Please sign in to comment.