Skip to content
Snippets Groups Projects
Commit 3273ea59 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

Do not open dev tool in debug mode, if not a SDK version

parent 4f2a9b49
No related branches found
No related tags found
No related merge requests found
Pipeline #4241 failed
// Rename "require" to avoid conflicts with pure JS libraries
requireNodejs = require
require = undefined
......@@ -11,8 +10,8 @@ const fs = requireNodejs('fs')
const path = requireNodejs('path')
const yaml = requireNodejs('js-yaml')
const bs58 = requireNodejs('bs58')
const gui = requireNodejs('nw.gui');
const clc = requireNodejs('cli-color');
const gui = requireNodejs('nw.gui');
Base58 = {
encode: (bytes) => bs58.encode(new Buffer(bytes)),
......@@ -53,6 +52,9 @@ const DEFAULT_CESIUM_SETTINGS = {
"showUDHistory": true
};
function isSdkMode () {
return gui && (window.navigator.plugins.namedItem('Native Client') !== null);
}
/**** Process command line args ****/
var commands = gui && gui.App && gui.App.argv;
......@@ -60,9 +62,13 @@ var debug = false;
if (commands && commands.length) {
for (i in commands) {
if (commands[i] === "--debug") {
console.log("[NW] Enabling DEV tool (--debug)");
console.log("[NW] Enabling debug mode (--debug)");
debug = true;
gui.Window.get().showDevTools();
// Open the DEV tool (need a SDK version of NW)
if (isSdkMode()) {
gui.Window.get().showDevTools();
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment