mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 00:34:14 +02:00
refactor(frontend): scripts -> utility
This commit is contained in:
18
packages/frontend/src/utility/initialize-sw.ts
Normal file
18
packages/frontend/src/utility/initialize-sw.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { lang } from '@@/js/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,
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user