Add JS and Style injection into AppShell

This commit is contained in:
2025-10-17 17:54:38 -07:00
parent 16cf44b42d
commit 0890ae3ef9
6 changed files with 64 additions and 4 deletions

View File

12
src/public/head.ts Normal file
View File

@@ -0,0 +1,12 @@
// Client-side script that runs in <head>
// Example: TypeScript with DOM types
(() => {
const logPageInfo = (): void => {
console.log('Page loaded in <head>');
};
if (document.readyState === 'loading') {
logPageInfo();
}
})();

View File

16
src/public/onLoad.ts Normal file
View File

@@ -0,0 +1,16 @@
// Client-side script that runs on page load
// Example: TypeScript with type annotations
(() => {
const setupPage = (): void => {
const links: NodeListOf<HTMLAnchorElement> = document.querySelectorAll('a');
console.log(`Found ${links.length} links on the page`);
};
// Run setup when DOM is ready
if (document.readyState !== 'loading') {
setupPage();
} else {
document.addEventListener('DOMContentLoaded', setupPage);
}
})();