| 26 | |
| 27 | //注册该窗口,同时检查是否是在白名单内 |
| 28 | export 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 | } |