css-theme-management
Version:
This package was created to ease the process of implementing multiple themes in an app.
23 lines (22 loc) • 826 B
JavaScript
import { themeLoader } from './theme_loader/theme_loader';
var ThemeManager = /** @class */ (function () {
function ThemeManager(themes, themeStorageKeyword) {
this._themes = themes;
this._themeStorageKeyword = themeStorageKeyword;
}
ThemeManager.prototype.loadTheme = function (theme, cacheSelection) {
themeLoader(this._themes[theme]);
if (cacheSelection) {
this.cacheSelection(theme);
}
};
ThemeManager.prototype.cacheSelection = function (theme) {
localStorage.setItem(this._themeStorageKeyword, theme);
};
ThemeManager.prototype.loadCache = function () {
return localStorage.getItem(this._themeStorageKeyword);
};
return ThemeManager;
}());
export { ThemeManager };
export default ThemeManager;