TelegramPWA/src/util/updateWebmanifest.ts
2025-04-23 18:57:46 +02:00

20 lines
529 B
TypeScript

// Original idea was found here
// https://medium.com/@alshakero/how-to-setup-your-web-app-manifest-dynamically-using-javascript-f7fbee899a61
import { DEBUG } from '../config';
import { IS_MAC_OS } from './browser/windowEnvironment';
export default function updateWebmanifest() {
if (!IS_MAC_OS) {
return;
}
const manifest = document.getElementById('the-manifest-placeholder');
if (!manifest) {
return;
}
const url = `site_apple${DEBUG ? '_dev' : ''}.webmanifest`;
manifest.setAttribute('href', url);
}