[Glitch] Convert easy entrypoints files to Typescript
Port 36909065b5
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/2701/head
parent
defd1e4024
commit
fe7db7905f
|
@ -2,7 +2,7 @@ import '@/entrypoints/public-path';
|
||||||
|
|
||||||
import { start } from 'flavours/glitch/common';
|
import { start } from 'flavours/glitch/common';
|
||||||
import { loadLocale } from 'flavours/glitch/locales';
|
import { loadLocale } from 'flavours/glitch/locales';
|
||||||
import main from "flavours/glitch/main";
|
import main from 'flavours/glitch/main';
|
||||||
import { loadPolyfills } from 'flavours/glitch/polyfills';
|
import { loadPolyfills } from 'flavours/glitch/polyfills';
|
||||||
|
|
||||||
start();
|
start();
|
||||||
|
@ -10,6 +10,6 @@ start();
|
||||||
loadPolyfills()
|
loadPolyfills()
|
||||||
.then(loadLocale)
|
.then(loadLocale)
|
||||||
.then(main)
|
.then(main)
|
||||||
.catch(e => {
|
.catch((e: unknown) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
});
|
});
|
|
@ -2,7 +2,9 @@ import '@/entrypoints/public-path';
|
||||||
import ready from 'flavours/glitch/ready';
|
import ready from 'flavours/glitch/ready';
|
||||||
|
|
||||||
ready(() => {
|
ready(() => {
|
||||||
const image = document.querySelector('img');
|
const image = document.querySelector<HTMLImageElement>('img');
|
||||||
|
|
||||||
|
if (!image) return;
|
||||||
|
|
||||||
image.addEventListener('mouseenter', () => {
|
image.addEventListener('mouseenter', () => {
|
||||||
image.src = '/oops.gif';
|
image.src = '/oops.gif';
|
||||||
|
@ -11,4 +13,6 @@ ready(() => {
|
||||||
image.addEventListener('mouseleave', () => {
|
image.addEventListener('mouseleave', () => {
|
||||||
image.src = '/oops.png';
|
image.src = '/oops.png';
|
||||||
});
|
});
|
||||||
|
}).catch((e: unknown) => {
|
||||||
|
console.error(e);
|
||||||
});
|
});
|
|
@ -16,7 +16,7 @@ function loaded() {
|
||||||
|
|
||||||
if (!attr) return;
|
if (!attr) return;
|
||||||
|
|
||||||
const props = JSON.parse(attr);
|
const props = JSON.parse(attr) as object;
|
||||||
const root = createRoot(mountNode);
|
const root = createRoot(mountNode);
|
||||||
|
|
||||||
root.render(<ComposeContainer {...props} />);
|
root.render(<ComposeContainer {...props} />);
|
||||||
|
@ -24,9 +24,13 @@ function loaded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
ready(loaded);
|
ready(loaded).catch((error: unknown) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPolyfills().then(main).catch(error => {
|
loadPolyfills()
|
||||||
console.error(error);
|
.then(main)
|
||||||
});
|
.catch((error: unknown) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
Loading…
Reference in New Issue