[Glitch] Convert easy entrypoints files to Typescript

Port 36909065b5 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/2701/head
Renaud Chaput 2024-04-29 10:02:41 +02:00 committed by Claire
parent defd1e4024
commit fe7db7905f
5 changed files with 16 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import '@/entrypoints/public-path';
import { start } from 'flavours/glitch/common';
import { loadLocale } from 'flavours/glitch/locales';
import main from "flavours/glitch/main";
import main from 'flavours/glitch/main';
import { loadPolyfills } from 'flavours/glitch/polyfills';
start();
@ -10,6 +10,6 @@ start();
loadPolyfills()
.then(loadLocale)
.then(main)
.catch(e => {
.catch((e: unknown) => {
console.error(e);
});

View File

@ -2,7 +2,9 @@ import '@/entrypoints/public-path';
import ready from 'flavours/glitch/ready';
ready(() => {
const image = document.querySelector('img');
const image = document.querySelector<HTMLImageElement>('img');
if (!image) return;
image.addEventListener('mouseenter', () => {
image.src = '/oops.gif';
@ -11,4 +13,6 @@ ready(() => {
image.addEventListener('mouseleave', () => {
image.src = '/oops.png';
});
}).catch((e: unknown) => {
console.error(e);
});

View File

@ -16,7 +16,7 @@ function loaded() {
if (!attr) return;
const props = JSON.parse(attr);
const props = JSON.parse(attr) as object;
const root = createRoot(mountNode);
root.render(<ComposeContainer {...props} />);
@ -24,9 +24,13 @@ function loaded() {
}
function main() {
ready(loaded);
ready(loaded).catch((error: unknown) => {
console.error(error);
});
}
loadPolyfills().then(main).catch(error => {
console.error(error);
});
loadPolyfills()
.then(main)
.catch((error: unknown) => {
console.error(error);
});