1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-12 05:38:51 +09:00
MisskeyIO/packages/frontend/src/scripts/initialize-sw.ts
2022-12-27 14:36:33 +09:00

14 lines
333 B
TypeScript

import { lang } from '@/config';
export async function initializeSw() {
if (!('serviceWorker' in navigator)) return;
navigator.serviceWorker.register(`/sw.js`, { scope: '/', type: 'classic' });
navigator.serviceWorker.ready.then(registration => {
registration.active?.postMessage({
msg: 'initialize',
lang,
});
});
}