Mario Theodoridis
Mario Theodoridis

Reputation: 271

how to tell whether a cordova debug build is running

Is there a way to tell in javascript, whether the running code is a debug or release build. This could facilitate constructs such as:

if (DEBUG) console.log("blah blah");

Upvotes: 4

Views: 1146

Answers (1)

kbsbng
kbsbng

Reputation: 2361

You can use the cordova module cordova-plugin-is-debug.

To add the plugin: cordova plugin add cordova-plugin-is-debug

To find if in debug mode:

cordova.plugins.IsDebug.getIsDebug(function(isDebug) {
    console.log("blah blah");
}, function(err) {
    console.error(err);
});

Upvotes: 4

Related Questions