playable
Version:
Video player based on HTML5Video
58 lines • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_THEME_CONFIG = void 0;
var tslib_1 = require("tslib");
var style_sheet_1 = require("./style-sheet");
var player_api_decorator_1 = (0, tslib_1.__importDefault)(require("../../../../core/player-api-decorator"));
var DEFAULT_THEME_CONFIG = {
color: '#FFF',
liveColor: '#ea492e',
progressColor: '#FFF',
};
exports.DEFAULT_THEME_CONFIG = DEFAULT_THEME_CONFIG;
var ThemeService = /** @class */ (function () {
function ThemeService(_a) {
var _this = this;
var themeConfig = _a.themeConfig;
this._styleSheet = new style_sheet_1.StyleSheet();
this._styleSheet.update((0, tslib_1.__assign)((0, tslib_1.__assign)({}, DEFAULT_THEME_CONFIG), themeConfig));
// setTimeout here is for calling `attach` after all modules resolved.
window.setTimeout(function () {
_this._styleSheet && _this._styleSheet.attach();
}, 0);
}
/**
* Method for setting theme for player instance
*
* @example
* player.updateTheme({
* progressColor: "#AEAD22"
* })
* @note
*
* You can check info about theming [here](/themes)
*
* @param themeConfig - Theme config
*
*/
ThemeService.prototype.updateTheme = function (themeConfig) {
this._styleSheet.update(themeConfig);
};
ThemeService.prototype.registerModuleTheme = function (module, rules) {
this._styleSheet.registerModuleTheme(module, rules);
};
ThemeService.prototype.get = function (module) {
return this._styleSheet.getModuleClassNames(module);
};
ThemeService.prototype.destroy = function () {
this._styleSheet = null;
};
ThemeService.moduleName = 'theme';
ThemeService.dependencies = ['themeConfig'];
(0, tslib_1.__decorate)([
(0, player_api_decorator_1.default)()
], ThemeService.prototype, "updateTheme", null);
return ThemeService;
}());
exports.default = ThemeService;
//# sourceMappingURL=theme-service.js.map