mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-26 07:43:09 +02:00
18 lines
451 B
TypeScript
18 lines
451 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { lang } from '@/config.js';
|
|
|
|
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,
|
|
});
|
|
});
|
|
}
|