2023-05-20 00:37:21 +02:00
|
|
|
import Builtin from "@structs/builtin";
|
|
|
|
|
|
|
|
import IPC from "@modules/ipc";
|
2022-01-26 18:12:40 +01:00
|
|
|
|
|
|
|
export default new class DevToolsListener extends Builtin {
|
|
|
|
get name() {return "DevTools";}
|
|
|
|
get category() {return "developer";}
|
|
|
|
get id() {return "devTools";}
|
|
|
|
|
|
|
|
initialize() {
|
|
|
|
super.initialize(...arguments);
|
|
|
|
this.toggleDevTools = this.toggleDevTools.bind(this);
|
|
|
|
document.addEventListener("keydown", this.toggleDevTools);
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleDevTools(e) {
|
2023-03-04 19:13:42 +01:00
|
|
|
const metaKey = process.platform === "darwin" ? e.metaKey : e.ctrlKey;
|
|
|
|
if (metaKey && e.shiftKey && e.key === "I") {
|
2022-01-26 18:12:40 +01:00
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
if (this.get(this.collection, this.category, this.id)) IPC.toggleDevTools();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|