TelegramPWA/src/util/updateWebmanifest.ts
2022-09-24 01:40:24 +02:00

20 lines
515 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 './environment';
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);
}