client.ts — astro Source File
Architecture documentation for client.ts, a typescript file in the astro codebase.
Entity Profile
Source Code
export default (parentElement: HTMLElement) =>
async (
Component: any,
props: Record<string, any>,
//{ default: children, ...slotted }: Record<string, any>,
//{ client }: Record<string, string>,
) => {
// in a real-world scenario, this would be a more complex function
// actually rendering the components return value (which might be an AST/VDOM)
const vdom = Component(props);
const node: Node = document.createElement(vdom.tag);
node.textContent = `${vdom.text} (rendered by client.ts)`;
parentElement.appendChild(node);
// cleanup
parentElement.addEventListener('astro:unmount', () => {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}, { once: true });
};
Source
Frequently Asked Questions
What does client.ts do?
client.ts is a source file in the astro codebase, written in typescript.
Where is client.ts in the architecture?
client.ts is located at packages/astro/test/fixtures/custom-renderer/src/custom-renderer/client.ts (directory: packages/astro/test/fixtures/custom-renderer/src/custom-renderer).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free