MCPcopy Create free account
hub / github.com/TanStack/hotkeys / createKeyHold

Function createKeyHold

packages/solid-hotkeys/src/createKeyHold.ts:46–59  ·  view source on GitHub ↗
(
  key: IndividualKey | (() => IndividualKey),
)

Source from the content-addressed store, hash-verified

44 * ```
45 */
46export function createKeyHold(
47 key: IndividualKey | (() => IndividualKey),
48): () => boolean {
49 const tracker = getKeyStateTracker()
50 const heldKeysSelector = useSelector(tracker.store, (state) => state.heldKeys)
51
52 return createMemo(() => {
53 const resolvedKey = typeof key === 'function' ? key() : key
54 const normalizedKey = resolvedKey.toLowerCase()
55 return heldKeysSelector().some(
56 (heldKey) => heldKey.toLowerCase() === normalizedKey,
57 )
58 })
59}

Callers 1

AppFunction · 0.90

Calls 1

getKeyStateTrackerFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…