共用方式為


onerror event

Occurs when an unhandled error has been raised.

Syntax

WinJS.Application.addEventListener("error", listenerName);
or
WinJS.Application.onerror = listenerName;

Event handler parameters

  • eventInfo
    Type: CustomEvent**

    An object that contains information about the event.

Remarks

The WinJS.Application.onerror catches all of the errors that would otherwise be caught by window.onerror. It also catches errors defined within the Windows Library for JavaScript, including Promise objects that have timed out or failed. It is recommended that you use WinJS.Application.onerror for top-level error handling in your app.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Application