Files
John Ahlroos c14a86b190
All checks were successful
Build & Release / build-docker-image (push) Successful in 1m51s
Build & Release / deploy-to-production (push) Successful in 8s
Add PWA manifest and SW
2026-04-10 21:08:45 +02:00

21 lines
656 B
Python

import streamlit as st
init = st.components.v2.component(
name="pwa",
isolate_styles=False,
js = """
export default function() {
// Manifest
const link = document.createElement("link");
link.rel = "manifest";
link.href = "./app/static/manifest.json";
document.head.appendChild(link);
// Service Worker
navigator.serviceWorker.register('./app/static/service-worker.js')
.then(reg => console.log('SW registered', reg))
.catch(err => console.log('SW registration failed', err));
}
""",
)