共用方式為


WinJS.Utilities.ready function

Ensures that the specified function executes only after the DOMContentLoaded event has fired for the current page. The DOMContentLoaded event occurs after the page has been parsed but before all the resources are loaded.

Syntax

WinJS.Utilities.ready(callback, async).done( /* Your success and error handlers */ );

Parameters

  • callback
    Type: Function

    A function that executes after the DOMContentLoaded event has occurred.

  • async
    Type: ****

    If true, the callback should be executed asynchronously.

Return value

Type: Promise

A promise that completes after the DOMContentLoaded event has occurred.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Utilities