Changeset View
Changeset View
Standalone View
Standalone View
get-app.js
Show All 39 Lines | async function renderPreview(uuid, elements) { | ||||
} | } | ||||
let output_dir = path.resolve(temporary_path); | let output_dir = path.resolve(temporary_path); | ||||
const component_instances = {}; | const component_instances = {}; | ||||
const path_prefix = `/previews/${uuid}`; | const path_prefix = `/previews/${uuid}`; | ||||
const s = new S({ output_dir, path_prefix }); | const s = new S({ output_dir, path_prefix }); | ||||
// creating componentsinstances | // creating components instances | ||||
for (const component_name in components) { | for (const component_name in components) { | ||||
component_instances[component_name] = new components[component_name](s); | component_instances[component_name] = new components[component_name](s); | ||||
} | } | ||||
// render preview using component instances | // render preview using component instances | ||||
for (const [componentName, componentProps] of elements) { | for (const [componentName, componentProps] of elements) { | ||||
html += await component_instances[componentName].render(componentProps); | html += await component_instances[componentName].render(componentProps); | ||||
} | } | ||||
Show All 28 Lines |