mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-23 00:29:22 +09:00
記録するホットキーはレートリミット式にする
This commit is contained in:
parent
b104485bb3
commit
40a7509286
@ -131,7 +131,13 @@ const matchPatterns = (ev: KeyboardEvent, action: Action) => {
|
||||
});
|
||||
};
|
||||
|
||||
let lastHotKeyStoreTimer: number | null = null;
|
||||
|
||||
const storePattern = (ev: KeyboardEvent, callback: CallbackFunction) => {
|
||||
if (lastHotKeyStoreTimer != null) {
|
||||
clearTimeout(lastHotKeyStoreTimer);
|
||||
}
|
||||
|
||||
latestHotkey = {
|
||||
which: [ev.key.toLowerCase()],
|
||||
ctrl: ev.ctrlKey || ev.metaKey,
|
||||
@ -139,6 +145,10 @@ const storePattern = (ev: KeyboardEvent, callback: CallbackFunction) => {
|
||||
shift: ev.shiftKey,
|
||||
callback,
|
||||
};
|
||||
|
||||
lastHotKeyStoreTimer = window.setTimeout(() => {
|
||||
latestHotkey = null;
|
||||
}, 500);
|
||||
};
|
||||
|
||||
const parseKeyCode = (input?: string | null) => {
|
||||
|
Loading…
Reference in New Issue
Block a user