次の方法で共有


Using the Windows Runtime in JavaScript

This documentation is archived and is not being maintained.

When you write a Universal Windows Platform (UWP) app, you can use Windows Runtime classes, methods, and properties in much the same way that you would use native JavaScript objects, methods, and properties. This topic provides introductory information and links to topics that explain the basic concepts of using Windows Runtime APIs in JavaScript, including an explanation of how Windows Runtime types are represented, how to use asynchronous Windows Runtime methods, and how to listen to and handle Windows Runtime events.

For general language documentation, check out MDN's JavaScript reference library.

Important

Windows Runtime features are not available for apps that run in Internet Explorer.

Windows Runtime reference documentation

For reference documentation, see Windows Runtime Reference. Code examples are available in JavaScript and also in C++, C#, and Visual Basic.

Writing Windows Runtime components in C++, C#, or Visual Basic

For instructions and guidelines for writing Windows Runtime components that can be consumed in JavaScript, see Creating Windows Runtime Components in C++ and Creating Windows Runtime Components in C# and Visual Basic.

Casing conventions with Windows Runtime features

Casing conventions for Windows Runtime features in JavaScript differ slightly from those for other languages:

  • Namespaces and classes are in Pascal case:

    Windows.Deployment.PackageInfo;
    
  • Members of classes, including methods and properties, and members of structures and enumerations, are in camel case:

    Deployment.PackageInfo.createPackage();
    
  • Event names are in lower case:

    dataTransferManager.ontargetapplicationchosen;
    

See also

Considerations when Using the Windows Runtime API
Using Windows Runtime Asynchronous Methods
Handling Windows Runtime Events in JavaScript
JavaScript Representation of Windows Runtime Types
JavaScript Projection of Windows Runtime DateTime and TimeSpan