Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Allows conditional execution of code in a JavaScript Windows Store app

License

Notifications You must be signed in to change notification settings

augustoproiete/WinRT-JsDebugSymbols

Repository files navigation

JavaScript Debug Symbols for WinRT NuGet Version

This module for WinRT JavaScript-based applications adds a property to the Debug global object that you can query to detect if the application is running with the Debug build configuration selected, allowing conditional execution of JavaScript code in a Windows Store app.

Getting Started

The JavaScript Debug Symbols for WinRT module is available on nuget.org via the package WinRT-JsDebugSymbols.

To install WinRT-JsDebugSymbols, run the following command in the Package Manager Console:

PM> Install-Package WinRT-JsDebugSymbols

Add a reference to the debugSymbols.js script in the header section of the default.html file:

<script src="/js/debugSymbols.js"></script>

Now you can query the Debug.isDebugBuild property during the execution of the Windows Store app to determine if the app is running a Debug build or not.

Example

// Example:
//   Show a dialog box with details of any unhandled
//   exceptions occurring in the application, only for
//   Debug builds.
if (Debug.isDebugBuild) {
    WinJS.Application.onerror = function (e) {

        var dialog = new Windows.UI.Popups.MessageDialog(
            e.detail.stack, e.detail.message);

        dialog.showAsync().done();

        return true;
    };
}

More information

Release History

Click on the Releases tab on GitHub.


Copyright © 2012 C. Augusto Proiete & Contributors - Provided under the Apache License, Version 2.0.