MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / isValidWindow

Function isValidWindow

src/main/focus-handler.ts:28–44  ·  view source on GitHub ↗
(
  identifier: BlackWhiteType
)

Source from the content-addressed store, hash-verified

26
27//注册该窗口,同时检查是否是在白名单内
28export async function isValidWindow(
29 identifier: BlackWhiteType
30): Promise<boolean> {
31 return activeWindow().then((res: any) => {
32 if (!res) {
33 return false;
34 }
35 const windowName = res.owner.name.toString();
36 console.log(identifier, windowName);
37 const windows = new Set(config.get<string[]>("activeWindows"));
38 if (!windows.has(windowName)) {
39 windows.add(windowName);
40 config.set("activeWindows", [...windows]);
41 }
42 return checkList(windowName, identifier);
43 });
44}

Callers 2

checkClipboardMethod · 0.90
bindHooksMethod · 0.90

Calls 4

checkListFunction · 0.85
getMethod · 0.45
hasMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected