description | title | author | ms.author | ms.date | ms.topic | ms.prod | ms.technology | keywords |
---|---|---|---|---|---|---|---|---|
Use the Windows Runtime (WinRT) to call native Windows APIs from your JavaScript app. |
Windows Runtime (WinRT) for JavaScript |
MSEdgeTeam |
msedgedevrel |
7/1/2018 |
article |
microsoft-edge |
windows-integration |
Windows Runtime, WinRT, PWA, JavaScript |
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 can call 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 Windows 10 app can 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 its 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 its UI. Note: APIs in the Windows.UI.Xaml namespace are not available for JavaScript apps (which can 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.
The Microsoft Edge WebView control enables you to host web content within your Windows 10 app. Its similar to using an <iframe>
, but provides a lot more features and control over the experience.
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.