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:
parent
62f2f5d830
commit
e99686346c
|
@ -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
|
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") + "/";
|
dataPath = path.join(dataPath, "BetterDiscord") + "/";
|
||||||
|
|
||||||
|
|
||||||
electron.app.once("ready", async () => {
|
|
||||||
if (!BetterDiscord.getSetting("developer", "reactDevTools")) return;
|
|
||||||
await ReactDevTools.install();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
let hasCrashed = false;
|
let hasCrashed = false;
|
||||||
export default class BetterDiscord {
|
export default class BetterDiscord {
|
||||||
static getWindowPrefs() {
|
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")) {
|
if (BetterDiscord.getSetting("general", "mediaKeys")) {
|
||||||
electron.app.commandLine.appendSwitch("disable-features", "HardwareMediaKeyHandling,MediaSessionService");
|
electron.app.commandLine.appendSwitch("disable-features", "HardwareMediaKeyHandling,MediaSessionService");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue