Freigeben über


Windows Runtime (WinRT) for JavaScript

This documentation is archived and is not being maintained.

The Windows Runtime (or simply WinRT) is the collection of native APIs that power the Universal Windows Platform (UWP) apps that run across all Windows 10 device families. WinRT APIs are projected into a number of different languages, including C#, C++, Visual Basic, and JavaScript.

As a web developer, you may request these native Windows APIs from JavaScript when your web app is running as an installed Windows 10 app (launched from the wwahost.exe process, rather than the browser). Additionally, your website running as a Windows 10 app may also use the Microsoft Edge webview control to display remote and local web content and MSApp APIs for blob and stream handling, among other things.

Here are the top-level WinRT namespace areas available to all Windows 10 apps:

WinRT Namespace Description
AI (Preview) Contains classes that enable apps to load machine learning models, bind data as inputs, and evaluate the results.
ApplicationModel Provides an app with access to core system functionality and run-time information about the app package, and handles suspend operations.
Data Provides utility classes for working with various data formats, including HTML, JSON, PDF, text, and XML.
Devices This namespace provides access to the low level device providers, including ADC, GPIO, I2 C, PWM, and SPI.
Foundation Enables fundamental Windows Runtime functionality, including managing asynchronous operations and accessing property stores. This namespace also defines common value types that represent Uniform Resource Identifier (URI), dates and times, 2-D measurements, and other basic values.
Gaming Provides access to game controller input, the Game bar, game monitoring, and game chat.
Globalization Provides globalization support for language profiles, geographic regions, and international calendars.
Graphics Provides basic data types that contain info on how to draw graphics. These data structs are commonly used to define how large surfaces are drawn when using the CompositionVirtualDrawingSurface class.
Management Provides capabilities to force a sync from an Mobile Device Management (MDM) device to the server. This MDM sync protocol is based on the Open Mobile Alliance - Device Management standard.
Media Provides classes for creating and working with media such as photos, audio recordings and videos.
Networking Provides access to hostnames and endpoints used by network apps.
Perception Contains classes for perceiving the user's surroundings, letting apps locate and reason about the device relative to the surfaces and holograms around the user.
Security Provides classes for user authentication, credentials management, cryptographic operations and enterprise data protection features.
Services Provides access to Microsoft services for Cortana, Maps, Microsoft Store and Targeted (subscription) content.
Storage Provides classes for managing files, folders, and application settings.
System Enables system functionality such as launching apps, obtaining information about a user, and memory profiling.
UI Provides an app with access to core system functionality and run-time information about the UI. NOTE: APIs in the Windows.UI.Xaml namespace are not available for JavaScript apps (which may use the equivalent web standards-based technologies).
Web Provides information on errors resulting from web service operations.

For more details on usage, check out Using the Windows Runtime in JavaScript. To learn how to run your website as a Windows app, try the Tailor your PWA for Windows tutorial.

WebView

The Microsoft Edge WebView control enables you to host web content within your Windows 10 app. This is similar to using an <iframe>, but provides a lot more features and control over the experience.

MSApp

The MSApp global object (window.MSApp) provides assorted helper functions for JavaScript-based Windows 10 apps, such as utilities for converting between web standards-based and equivalent WinRT object types.