media.ts — astro Source File
Architecture documentation for media.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 01ab2549_4bc5_bedb_64e4_2c6dea668e57["media.ts"] 4c453c0b_17bb_ebc3_f7de_e2a632e42c1e["../types/public/integrations.js"] 01ab2549_4bc5_bedb_64e4_2c6dea668e57 --> 4c453c0b_17bb_ebc3_f7de_e2a632e42c1e style 01ab2549_4bc5_bedb_64e4_2c6dea668e57 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { ClientDirective } from '../../types/public/integrations.js';
/**
* Hydrate this component when a matching media query is found
*/
const mediaDirective: ClientDirective = (load, options) => {
const cb = async () => {
const hydrate = await load();
await hydrate();
};
if (options.value) {
const mql = matchMedia(options.value);
if (mql.matches) {
cb();
} else {
mql.addEventListener('change', cb, { once: true });
}
}
};
export default mediaDirective;
Domain
Subdomains
Functions
Dependencies
- ../types/public/integrations.js
Source
Frequently Asked Questions
What does media.ts do?
media.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in media.ts?
media.ts defines 1 function(s): mediaDirective.
What does media.ts depend on?
media.ts imports 1 module(s): ../types/public/integrations.js.
Where is media.ts in the architecture?
media.ts is located at packages/astro/src/runtime/client/media.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/runtime/client).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free