本页还没有译文
本页 30 段还没译成简体中文,下面显示的是英文原文。createSequenceMatcher
还没翻译译自英文(tanstack.com)本页 30 段都还没译
function createSequenceMatcher(sequence, options?): object;Defined in: sequence-manager.ts:704
Creates a simple sequence matcher for one-off use.
This is a low-level helper that does not support ignoreInputs, target, or other HotkeyOptions. Callers must handle input filtering themselves if attaching to document.
Parameters
sequence
The sequence of hotkeys to match
options?
Options including timeout
platform?
"mac" | "windows" | "linux"
timeout?
number
Returns
object
An object with match() and reset() methods
getProgress
getProgress: () => number;Returns
number
match
match: (event) => boolean;Parameters
event
KeyboardEvent
Returns
boolean
reset
reset: () => void;Returns
void
Example
const matcher = createSequenceMatcher(['G', 'G'], { timeout: 500 })
document.addEventListener('keydown', (event) => {
if (matcher.match(event)) {
console.log('Sequence matched!')
}
})AI 翻译查看英文原文