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:
Qb 2021-07-26 15:19:16 +00:00 committed by GitHub
parent 62f2f5d830
commit e99686346c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

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");
}
}