astro
Version:
Astro is a modern site builder with web best practices, performance, and DX front-of-mind.
21 lines (20 loc) • 440 B
JavaScript
import { ContentLayer } from "./content-layer.js";
function contentLayerSingleton() {
let instance = null;
return {
init: (options) => {
instance?.dispose();
instance = new ContentLayer(options);
return instance;
},
get: () => instance,
dispose: () => {
instance?.dispose();
instance = null;
}
};
}
const globalContentLayer = contentLayerSingleton();
export {
globalContentLayer
};