There are some cases where we want a block of o code or function to be executed only when we are debugging the application, usually to show detailed error messages that are intended only for the developer to see.
To be able to detect if the debugger is active during the execution of the application, we can access the Debug object and check the property debuggerEnabled, which will have the value true when the debugger is active:
if (Debug.debuggerEnabled) {
// We are debugging the app (eg.: F5)
}
else {
// We are running the app without debugging (e.g.: CTRL + F5)
};
Note: This property is not visible through the Intellisense, but it exists and is used by the WinJS library in the file base.js.













Pingback: Global exception handling in Windows Store JavaScript applications | Caio Proiete (EN)