Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Hotkeys API Reference
App Hotkeys API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Normalization & format API Reference
Hotkeys API Reference

createSequenceMatcher

ts
function createSequenceMatcher(sequence, options?): object;
function createSequenceMatcher(sequence, options?): object;

Defined in: match.ts:233

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

RegisterableHotkeySequence

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

ts
getProgress: () => number;
getProgress: () => number;

Returns

number

match

ts
match: (event) => boolean;
match: (event) => boolean;

Parameters

event

KeyboardEvent

Returns

boolean

reset

ts
reset: () => void;
reset: () => void;

Returns

void

Example

ts
const matcher = createSequenceMatcher(['G', 'G'], { timeout: 500 })

document.addEventListener('keydown', (event) => {
  if (matcher.match(event)) {
    console.log('Sequence matched!')
  }
})
const matcher = createSequenceMatcher(['G', 'G'], { timeout: 500 })

document.addEventListener('keydown', (event) => {
  if (matcher.match(event)) {
    console.log('Sequence matched!')
  }
})