MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / sharedKeyPressListner

Function sharedKeyPressListner

src/pages/components/ScriptMenuList/index.tsx:472–480  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

470 }
471 if (!checkItems.size) return;
472 const sharedKeyPressListner = (e: KeyboardEvent) => {
473 const keyUpper = e.key.toUpperCase();
474 checkItems.forEach(([uuid, accessKeyUpper, _name, menuItems]) => {
475 if (keyUpper === accessKeyUpper) {
476 // 快速键触发不需传递 options(autoClose 由 sendMenuAction 内部处理)。
477 sendMenuAction(uuid, {}, menuItems);
478 }
479 });
480 };
481 document.addEventListener("keypress", sharedKeyPressListner);
482 return () => {
483 checkItems.clear();

Callers

nothing calls this directly

Calls 2

sendMenuActionFunction · 0.85
forEachMethod · 0.80

Tested by

no test coverage detected