21 lines
656 B
Python
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));
|
|
}
|
|
""",
|
|
) |