|
@@ -0,0 +1,35 @@
|
|
|
+import { createLog } from "@/utils/logger";
|
|
|
+
|
|
|
+if (typeof nodeRequire !== "undefined") {
|
|
|
+ console.log("考生端,disable key");
|
|
|
+ createLog({
|
|
|
+ page: "electron",
|
|
|
+ action: "禁用key",
|
|
|
+ });
|
|
|
+
|
|
|
+ let remote = window.nodeRequire("electron").remote;
|
|
|
+ // const { electron, dialog } = remote;
|
|
|
+ // console.log(remote);
|
|
|
+ // Module to control application life.
|
|
|
+ // const app = remote.app;
|
|
|
+ const { globalShortcut } = remote;
|
|
|
+ // app.whenReady().then(() => {
|
|
|
+ // Register a 'CommandOrControl+Y' shortcut listener.
|
|
|
+ if (globalShortcut.isRegistered("Super+Y")) {
|
|
|
+ console.log("reged");
|
|
|
+ createLog({
|
|
|
+ page: "electron",
|
|
|
+ action: "reged->unreg",
|
|
|
+ });
|
|
|
+ globalShortcut.unregisterAll();
|
|
|
+ }
|
|
|
+ // globalShortcut.registerAll(["Super+Tab"], () => {
|
|
|
+ globalShortcut.register("Super+Y", () => {
|
|
|
+ console.log("key clicked");
|
|
|
+ createLog({
|
|
|
+ page: "electron",
|
|
|
+ action: "禁用key-pressed",
|
|
|
+ });
|
|
|
+ // Do stuff when Y and either Command/Control is pressed.
|
|
|
+ });
|
|
|
+}
|