/**
* @module server/themesManager
*/
let themes = {}
/**
* registers a theme for reuse across documents
* @param themeId {string} theme identifier
* @param themeFunc {func} function which gets a `slide` object and creates a theme for it
*/
module.exports.registerTheme = function (themeId, themeFunc) {
themes[themeId] = themeFunc
}
/**
* gets a theme by id
* @param themeId {string} theme identifier
* @returns {func} theme function registered by {@link registerTheme}
*/
module.exports.getThemeFunc = function (themeId) {
let theme = themes[themeId]
if (!theme) {
throw new Error(`theme ${themeId} is not registered`)
}
return theme
}