🚀 xsukax PWA Transformer

Transform any website into a Progressive Web App with one line of code

📦 CDN Usage (One Line)

Add this single line to any HTML page:

<script src="https://cdn.jsdelivr.net/gh/xsukax/xsukax-PWA-Transformer@main/pwa.js" data-auto-init data-app-name="My App" data-theme-color="#4a90e2"></script>

That's it! Your site is now a PWA with offline support and installation capability.

🎯 Available CDN Options

jsDelivr (Recommended - Fast & Reliable):

https://cdn.jsdelivr.net/gh/xsukax/xsukax-PWA-Transformer@main/pwa.js

GitHub Raw:

https://raw.githubusercontent.com/xsukax/xsukax-PWA-Transformer/main/pwa.js

Statically:

https://cdn.statically.io/gh/xsukax/xsukax-PWA-Transformer/main/pwa.js

⚙️ Configuration Options

Minimal (App name and theme only):

<script src="https://cdn.jsdelivr.net/gh/xsukax/xsukax-PWA-Transformer@main/pwa.js" data-auto-init data-app-name="My Localhost" data-theme-color="#2c3e50"></script>

Full configuration:

<script src="https://cdn.jsdelivr.net/gh/xsukax/xsukax-PWA-Transformer@main/pwa.js" data-auto-init data-app-name="My Localhost" data-app-short-name="Localhost" data-theme-color="#2c3e50" data-background-color="#ffffff"></script>

🎨 Manual Initialization

For advanced configuration, use manual initialization:

<script src="https://cdn.jsdelivr.net/gh/xsukax/xsukax-PWA-Transformer@main/pwa.js"></script> <script>PWA.init({appName:'My App',themeColor:'#4a90e2',cacheStrategy:'cacheFirst'});</script>

📱 Installation Handling

Add an install button to your page:

<button id="installBtn" onclick="PWA.install()">Install App</button> <script>window.addEventListener('pwa-install-available',()=>{document.getElementById('installBtn').style.display='block';});</script>

🔧 Service Worker

The library automatically tries to load sw.js from:

No manual setup required! The library handles everything automatically.

✅ Current Status

Initializing PWA...

🌟 Features

📚 API Reference

Initialization:

PWA.init({appName:'My App',themeColor:'#4a90e2'})

Installation:

PWA.install() - Trigger install prompt
PWA.canInstall() - Check if installable
PWA.isStandalone() - Check if installed

Service Worker:

PWA.downloadServiceWorker() - Download sw.js
PWA.clearCache() - Clear all caches
PWA.unregister() - Unregister service worker

Info:

PWA.getInfo() - Get all PWA information
PWA.isOnline() - Check network status

📄 License & Credits

Author: xsukax

Website: xsukax.com

GitHub: github.com/xsukax/xsukax-PWA-Transformer

License: GPL-3.0

Copyright © 2025 xsukax