Add PWA manifest and SW
This commit is contained in:
21
app/components/pwa.py
Normal file
21
app/components/pwa.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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));
|
||||
}
|
||||
""",
|
||||
)
|
||||
Reference in New Issue
Block a user