mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2024-04-21 12:32:08 +00:00
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import { init as initCSS } from "../helpers/loader.js";
|
|
import { report } from "../helpers/log.js";
|
|
import { $error } from "./common.js";
|
|
|
|
export default async function main() {
|
|
try {
|
|
await Promise.all([
|
|
setup_device(),
|
|
setup_blue_death_screen(),
|
|
setup_history(),
|
|
setup_css(),
|
|
]);
|
|
window.dispatchEvent(new window.Event("pagechange"));
|
|
} catch (err) {
|
|
console.error(err);
|
|
const msg = window.navigator.onLine === false ? "OFFLINE" : (err.message || "CAN'T LOAD");
|
|
report("boot::" + msg, err, location.href);
|
|
$error(msg);
|
|
}
|
|
}
|
|
main();
|
|
|
|
async function setup_device() {
|
|
const className = "ontouchstart" in window ? "touch-yes" : "touch-no";
|
|
document.body.classList.add(className);
|
|
}
|
|
|
|
async function setup_blue_death_screen() {
|
|
window.onerror = function(msg, url, lineNo, colNo, error) {
|
|
report("boot::" + msg, error, url, lineNo, colNo);
|
|
$error(msg);
|
|
};
|
|
}
|
|
|
|
async function setup_history() {
|
|
window.history.replaceState({}, "");
|
|
}
|
|
|
|
async function setup_css() {
|
|
return initCSS();
|
|
}
|