@communities-webruntime/services
Version:
If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).
28 lines • 1.47 kB
JavaScript
;
/**
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTemplateGenerator = exports.getTemplateGenerators = exports.registerTemplateGenerators = void 0;
const assert_1 = require("../utils/assert");
const default_component_template_generator_1 = require("./default-component-template-generator");
const templateGeneratorRegistry = [];
const defaultComponentTemplateGenerator = new default_component_template_generator_1.DefaultComponentTemplateGenerator();
function registerTemplateGenerators(...templateGenerators) {
templateGenerators.forEach(tg => templateGeneratorRegistry.push(tg));
}
exports.registerTemplateGenerators = registerTemplateGenerators;
function getTemplateGenerators() {
return templateGeneratorRegistry;
}
exports.getTemplateGenerators = getTemplateGenerators;
function getTemplateGenerator(componentName) {
assert_1.assert(!(componentName === null || componentName === undefined), `Cannot retrieve template generator for ${componentName}`);
return (templateGeneratorRegistry.filter(item => item.getComponentName() === componentName)[0] ||
defaultComponentTemplateGenerator);
}
exports.getTemplateGenerator = getTemplateGenerator;
//# sourceMappingURL=template-generator-registry.js.map