Thread viewer for Bluesky

call init via DOMContentLoaded

+4 -9
+1 -5
index.html
··· 4 4 <meta charset="UTF-8"> 5 5 <meta http-equiv="Content-Security-Policy" content=" 6 6 default-src 'none'; 7 - script-src 'self' 'sha256-C5RUxaoIkpRux1/UhIgLL5RalHWo6EOGHzWOhCMr8Fs='; 7 + script-src 'self'; 8 8 style-src 'self'; 9 9 img-src 'self' https:; 10 10 font-src 'self'; ··· 30 30 </div> 31 31 32 32 <script src="dist/skythread.js"></script> 33 - 34 - <script> 35 - init(); 36 - </script> 37 33 </body> 38 34 </html>
+3 -3
src/skythread.ts
··· 1 - import * as svelte from 'svelte'; 1 + import { mount } from 'svelte'; 2 2 import { parseURLParams } from './router.js'; 3 3 import App from './App.svelte'; 4 4 5 5 function init() { 6 6 let params = parseURLParams(location.search); 7 - svelte.mount(App, { target: document.body, props: { params }}); 7 + mount(App, { target: document.body, props: { params }}); 8 8 } 9 9 10 - window.init = init; 10 + document.addEventListener("DOMContentLoaded", init);
-1
src/types.d.ts
··· 1 1 interface Window { 2 2 root: AnyPost; 3 3 subtreeRoot: AnyPost; 4 - init: () => void; 5 4 } 6 5 7 6 type json = Record<string, any>;