4ecc42744c
* create file * wip * fix * wip * tabun dekita * ✌️ * implement subscribe push notification button to tutorial * check-exists→show-registration * add column sendReadMessage * fix migration file * sw api * change PushNotificationService * wip * ✌️ * fix tutorial footer flex
13 lines
333 B
TypeScript
13 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,
|
|
});
|
|
});
|
|
}
|