ReactDevTools: fixed race condition (#898)

```js
console.log('READY STATE '+ electron.app.isReady());
electron.app.once("loaded", async ()=>{console.log("loaded");});
electron.app.whenReady().then(async ()=>{console.log("whenReady");});
```
Results in the following when the app is already ready.
```
READY STATE true
whenReady
[... loaded will be logged]
```
This will not fix the race condition when opening the devtools. You want to open the devtools as **early** as possible for the tabs to show up.
This commit is contained in:
2021-07-26 15:19:16 +00:00
parent 5e5a01784e
commit 5ed03bcf01
+7 -8
View File
@@ -15,13 +15,6 @@ if (process.platform === "win32" || process.platform === "darwin") dataPath = pa
else dataPath = process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : path.join(process.env.HOME, ".config"); // This will help with snap packages eventually
dataPath = path.join(dataPath, "BetterDiscord") + "/";
electron.app.once("ready", async () => {
if (!BetterDiscord.getSetting("developer", "reactDevTools")) return;
await ReactDevTools.install();
});
let hasCrashed = false;
export default class BetterDiscord {
static getWindowPrefs() {
@@ -114,6 +107,12 @@ export default class BetterDiscord {
}
}
if (BetterDiscord.getSetting("developer", "reactDevTools")) {
electron.app.whenReady().then(async ()=>{
await ReactDevTools.install();
});
}
if (BetterDiscord.getSetting("general", "mediaKeys")) {
electron.app.commandLine.appendSwitch("disable-features", "HardwareMediaKeyHandling,MediaSessionService");
}
}