@rr0/cms
Version:
RR0 Content Management System (CMS)
25 lines (24 loc) • 825 B
JavaScript
import { SourceRegistry } from "./SourceRegistry.js";
import { FileContents } from "@javarome/fileutil";
/**
* Create Source objects and register them.
*/
export class PersistentSourceRegistry extends SourceRegistry {
constructor(dataService, http, baseUrl, fileName, options, time) {
super(dataService, http, baseUrl, options, time);
this.fileName = fileName;
try {
const registryFileContents = FileContents.read(fileName, "utf-8").contents;
this.registry = JSON.parse(registryFileContents);
}
catch (e) {
console.warn("Could not read persistent source registry", fileName, e);
}
}
async get(href) {
return super.get(href);
}
async register(href, source) {
return super.register(href, source);
}
}