contentObservable() — astro Function Reference
Architecture documentation for the contentObservable() function in utils.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 7b23a9eb_5437_4f11_b652_ce9864e4d78e["contentObservable()"] 7a09e708_c090_71c0_8138_7343699b1865["utils.ts"] 7b23a9eb_5437_4f11_b652_ce9864e4d78e -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865 60f9d17b_4787_7be4_94e7_e5fe48a70363["fn()"] 7b23a9eb_5437_4f11_b652_ce9864e4d78e -->|calls| 60f9d17b_4787_7be4_94e7_e5fe48a70363 style 7b23a9eb_5437_4f11_b652_ce9864e4d78e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/content/utils.ts lines 675–697
function contentObservable(initialCtx: ContentCtx): ContentObservable {
type Subscriber = (ctx: ContentCtx) => void;
const subscribers = new Set<Subscriber>();
let ctx = initialCtx;
function get() {
return ctx;
}
function set(_ctx: ContentCtx) {
ctx = _ctx;
subscribers.forEach((fn) => fn(ctx));
}
function subscribe(fn: Subscriber) {
subscribers.add(fn);
return () => {
subscribers.delete(fn);
};
}
return {
get,
set,
subscribe,
};
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does contentObservable() do?
contentObservable() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is contentObservable() defined?
contentObservable() is defined in packages/astro/src/content/utils.ts at line 675.
What does contentObservable() call?
contentObservable() calls 1 function(s): fn.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free