# msger Storage API Demo

✅ What Works: localStorage-based persistence API, F11 fullscreen toggle
❌ What's Broken: All window controls via JavaScript (IPC crashes)
🔧 How to Close: Click the X button (top-right corner) or press Alt+F4
⚠️ Window Controls Disabled
Due to a wry library bug, all window operations via JavaScript crash the app. Configure window at startup using CLI flags: `-size 800,600 -title "My App"`
F11 Note: F11 now works using HTML5 Fullscreen API (press F11 to toggle, Esc to exit)

## Data Storage (Native localStorage)

Recommendation: Use native `localStorage` for compatibility. Works in any browser context, not just msger.

The msger storage API is just a thin convenience wrapper around localStorage - native API is preferred.

Hello from msger!
Try saving simple text or complex objects

## Manage Storage

Click to list or clear data

## Window Controls (⚠️ Currently Broken)

These buttons demonstrate the broken IPC window controls. They will log errors but not crash.

Click any button to see why window controls don't work

Why broken: wry 0.47.2 has a bug where window.ipc.postMessage() crashes with "InvalidUri" error.
Workarounds: Use CLI flags (-size, -title), F11 for fullscreen, X button to close, or Alt+F4.

## Download Files (Browser Blob API)

Download content as a file using the browser's standard Blob + download API. No msger API needed - this is just a standard web feature!

This is sample text that can be downloaded to your file system.
Click to download as a file to your computer

## Storage Location & PWA Support

localStorage is saved to:

`%LOCALAPPDATA%\Microsoft\Edge\User Data\WebView2\Default\Local Storage\leveldb\`

Data persists across sessions and survives app restarts. Each URL origin has its own storage partition.

Click to see current storage info

### PWA Support ✅

msger supports Progressive Web Apps loaded via `-url`:

- ✅ Service Workers - Background sync, offline support
- ✅ IndexedDB - Large data storage (GBs)
- ✅ Cache API - Offline assets
- ✅ localStorage/sessionStorage - Simple key-value storage
- ✅ Web Manifest - App metadata
- ❌ Push Notifications - Platform dependent
- ❌ "Install" UI - Already native window

Example: `node cli.js -url https://your-pwa.app -detach`