static-cms/src/lib/registry.js

27 lines
563 B
JavaScript
Raw Normal View History

2016-09-11 23:08:18 +02:00
const _registry = {
templates: {},
2016-09-11 23:08:18 +02:00
previewStyles: [],
widgets: {}
};
2016-09-11 23:08:18 +02:00
export default {
registerPreviewStyle(style) {
_registry.previewStyles.push(style);
},
registerPreviewTemplate(name, component) {
_registry.templates[name] = component;
},
getPreviewTemplate(name) {
return _registry.templates[name];
},
getPreviewStyles() {
return _registry.previewStyles;
},
registerWidget(name, control, preview) {
_registry.widgets[name] = { control, preview };
},
getWidget(name) {
return _registry.widgets[name];
}
};