Only pen dev tools when not already open

This commit is contained in:
Kevin Sawicki
2015-04-27 18:28:29 -07:00
parent b5839a8960
commit 313c8a73ce

View File

@@ -135,19 +135,25 @@ var setupVmCompatibility = function() {
}
var profileStartup = function(cacheDir, loadSettings) {
var profile = function() {
console.profile('startup');
try {
setupWindow(cacheDir, loadSettings);
} catch (error) {
handleSetupError(error);
} finally {
console.profileEnd('startup');
console.log("Switch to the Profiles tab to view the created startup profile")
}
};
var currentWindow = require('remote').getCurrentWindow();
currentWindow.openDevTools();
currentWindow.once('devtools-opened', function() {
setTimeout(function() {
console.profile('startup');
try {
setupWindow(cacheDir, loadSettings);
} catch (error) {
handleSetupError(error);
} finally {
console.profileEnd('startup');
console.log("Switch to the Profiles tab to view the created startup profile")
}
}, 100);
});
if (currentWindow.devToolsWebContents) {
profile();
} else {
currentWindow.openDevTools();
currentWindow.once('devtools-opened', function() {
setTimeout(profile, 100);
});
}
}