npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

capacitor-xbox

v1.1.15

Published

Capacitor for xbox and UWP, powered by UWPjs.

Readme

Capacitor Xbox

Capacitor Xbox brings Capacitor apps to UWP/WebView2 for Windows and Xbox. It ships a ready UWP.js host, a native C# WinRT bridge, and a Capacitor 8 runtime shim so a web app can call native-backed Capacitor-style APIs on Microsoft platforms.

| Windows | Xbox | iOS | |---------|------|-----| | Windows UWP app running Capacitor Xbox | Xbox UWP app running Capacitor Xbox | iOS Capacitor app sharing the same web codebase | | capacitor-xbox | capacitor-xbox | Capacitor |

It is not affiliated with Capacitor, Ionic, Microsoft, or Xbox.

What You Get

  • UWP/WebView2 host generation for Windows and Xbox
  • Capacitor 8-compatible runtime globals inside the UWP host
  • Broad native-backed plugin surface for Capacitor app APIs
  • Neutral uwp.js bridge for direct UWP.js usage
  • Xbox-focused host behavior: back button forwarding, controller vibration, in-app toasts, cursor control, and centered browser overlays
  • CLI workflow with capacitor-xbox init and capacitor-xbox sync

Capacitor 8 Runtime

  • @capacitor/core peer dependency: >=8.0.0 <9.0.0
  • typed exports for capacitor-xbox, capacitor-xbox/uwp, and capacitor-xbox/capacitorUWP
  • UWP/Xbox plugin headers for official-style Capacitor plugin proxies
  • CapacitorCustomPlatform plugin map inside the WebView2 host
  • native bridge globals: PluginHeaders, nativePromise, and nativeCallback
  • safe browser imports outside UWP, so normal web/iOS/Android builds keep their default Capacitor behavior

Install

npm install capacitor-xbox

Create or sync the UWP project:

npx capacitor-xbox init
npm run build
npx capacitor-xbox sync

Useful sync options:

npx capacitor-xbox sync --patch-wasm
npx capacitor-xbox sync --patch-css

App Entry Setup

Make capacitor-xbox/capacitorUWP the first Capacitor runtime import in your app entry. Plugin packages loaded after it register against the UWP/Xbox runtime.

import "capacitor-xbox/capacitorUWP";
import { Preferences } from "@capacitor/preferences";

await window.CapacitorUWP?.ready;

await Preferences.set({ key: "theme", value: "dark" });
const result = await Preferences.get({ key: "theme" });
console.log(result.value);

For raw UWP.js usage without Capacitor:

import UwpBridge from "capacitor-xbox/uwp";

const uwp = new UwpBridge();
await uwp.hideCursor();
await uwp.showCursor();

Runtime Behavior

Inside the generated UWP WebView2 host, capacitor-xbox/capacitorUWP auto-installs:

  • window.Capacitor
  • window.capacitor
  • window.CapacitorUWP
  • CapacitorCustomPlatform
  • PluginHeaders
  • nativePromise
  • nativeCallback

The bridge exposes window.CapacitorUWP.ready for deterministic app startup inside the host. Outside UWP, normal web/iOS/Android Capacitor behavior stays unchanged.

Supported API Surface

Supported plugin surface:

  • ActionSheet
  • App
  • AppLauncher
  • Browser
  • InAppBrowser
  • Clipboard
  • Device
  • Dialog
  • LocalNotifications
  • Motion
  • Network
  • Preferences
  • PushNotifications
  • ScreenOrientation
  • ScreenReader
  • Share
  • SplashScreen
  • TextZoom
  • Toast
  • Camera
  • Filesystem
  • FileTransfer
  • FileViewer
  • Geolocation
  • Haptics
  • Keyboard
  • CapacitorBarcodeScanner
  • SecureStorage
  • UserVerification
  • CapacitorBackgroundRunner / BackgroundRunner
  • CapacitorGoogleMaps / GoogleMaps

The host maps these APIs to real UWP/WinRT features where the platform provides them: WebView2, app notifications/toasts, PasswordVault, UserConsentVerifier, storage folders/pickers, CameraCaptureUI, Geolocator, NetworkInformation, clipboard, share UI, display/input events, sensors, speech synthesis, WNS push, and POS barcode scanner hardware.

Platform Mapping

Capacitor Xbox keeps the app-facing API familiar while using the Microsoft platform underneath:

  • Browser and InAppBrowser use the built-in WebView2 overlay or Windows launcher flow.
  • GoogleMaps runs through a Leaflet/OpenStreetMap-backed map surface.
  • BackgroundRunner uses Windows background-task scheduling plus a hidden WebView2 runner.
  • PushNotifications use WNS.
  • CapacitorBarcodeScanner uses UWP POS scanner hardware.
  • iOS/Android-only controls return structured platform results when UWP has no matching system concept.

UWP Host Features

The generated UWP host includes:

  • WebView2 local asset hosting
  • local app data virtual host mapping
  • RPC timeout handling
  • native-to-JS event forwarding
  • centered embedded browser overlay
  • Xbox-friendly in-app toast overlay
  • Windows app notifications
  • back button forwarding
  • controller vibration
  • persistent cursor hide/show API
  • optional background script dispatch

The cursor is hidden by default in the host and reapplied on pointer/window events. Use uwp.hideCursor() and uwp.showCursor() from the neutral UWP.js bridge when you need to control it.

Project Structure

After init, a project typically looks like:

my-capacitor-xbox-project/
├─ package.json
├─ capacitor.config.ts
├─ resources/
├─ uwp_js.config.json
├─ uwp/
│  └─ <ProjectName>/
│     ├─ MainPage.xaml
│     ├─ MainPage.xaml.cs
│     ├─ <ProjectName>.csproj
│     ├─ Package.appxmanifest
│     ├─ Assets/
│     │  └─ WP/
│     └─ ...
└─ ...

Assets/WP is where your built web app is copied during capacitor-xbox sync.

Notes

  • Build the web app first, then run capacitor-xbox sync.
  • On Xbox, file pickers, camera UI, background execution, and hardware APIs depend on device policy and installed capabilities.
  • WebAssembly or zip assets may need --patch-wasm or other packaging workarounds for WebView2/Edge loading behavior.
  • Native UWP compilation still needs Visual Studio/Windows tooling.

Extending The Native Host

The C# backend lives in the generated UWP project. Add native methods to UwpNativeMethods as public Task<string> methods, then call them from the JavaScript bridge with bridge.callNative(...) or a typed wrapper in uwp.js.

Keep the native host neutral. Capacitor-specific behavior should stay in capacitorUWP.js; the UWP host should expose generic UWP.js capabilities.

Links

  • npm: https://www.npmjs.com/package/capacitor-xbox
  • UWP.js: https://github.com/momo-AUX1/UWP.js
  • Capacitor: https://capacitorjs.com/