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
API Reference
Hotkeys API Reference
Hotkey Sequence API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Hotkey Sequence Recorder API Reference
Normalization & format API Reference
Hotkey Sequence API Reference

hotkeySequence

Function: hotkeySequence()

ts
function hotkeySequence(sequence, options): <T>(proto, methodName, descriptor) => void;
function hotkeySequence(sequence, options): <T>(proto, methodName, descriptor) => void;

Defined in: decorators/hotkey-sequence.ts:30

Decorator that registers a keyboard sequence (e.g. Vim-style) on the element when it connects and unregisters when it disconnects. Uses HotkeySequenceController under the hood.

Parameters

sequence

HotkeySequence

The key sequence to listen for (e.g. ['G', 'G'] for "g g").

options

SequenceOptions = HOTKEY_SEQUENCE_DEFAULT_OPTIONS

Optional sequence options (target, timeout, enabled, etc.).

Returns

A method decorator for use on LitElement methods.

ts
<T>(
   proto, 
   methodName, 
   descriptor): void;
<T>(
   proto, 
   methodName, 
   descriptor): void;

Type Parameters

T

T extends HotkeyCallback

Parameters

proto

LitElement

methodName

string

descriptor

TypedPropertyDescriptor<T>

Returns

void

Example

ts
class MyElement extends LitElement {
  @hotkeySequence(['G', 'G'])
  goToTop() { window.scrollTo(0, 0) }

  @hotkeySequence(['D', 'D'], { timeout: 500 })
  deleteLine() { this.deleteCurrentLine() }
}
class MyElement extends LitElement {
  @hotkeySequence(['G', 'G'])
  goToTop() { window.scrollTo(0, 0) }

  @hotkeySequence(['D', 'D'], { timeout: 500 })
  deleteLine() { this.deleteCurrentLine() }
}