44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
/*
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
import { StrictMode } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
import dayjs from 'dayjs';
|
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
import { App } from '@/App';
|
|
import '@/index.css';
|
|
// roboto font
|
|
import '@fontsource/roboto';
|
|
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
|
|
import { loadDayJsLocale } from '@/util/language.tsx';
|
|
|
|
dayjs.extend(customParseFormat);
|
|
|
|
loadDayJsLocale(navigator.language).then(() => {
|
|
dayjs.locale(navigator.language);
|
|
});
|
|
|
|
if ('serviceWorker' in navigator) {
|
|
navigator.serviceWorker.ready.then((registration) => {
|
|
registration.unregister().catch(defaultPromiseErrorHandler('unregister service workers'));
|
|
if (caches) {
|
|
caches.keys().then(async (names) => {
|
|
await Promise.all(names.map((name) => caches.delete(name)));
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
const container = document.getElementById('root');
|
|
const root = createRoot(container!);
|
|
root.render(
|
|
<StrictMode>
|
|
<App />
|
|
</StrictMode>,
|
|
);
|