UNPKG

playable

Version:

Video player based on HTML5Video

59 lines 2.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var view_1 = (0, tslib_1.__importDefault)(require("../core/view")); var templates_1 = require("./templates"); var syntaxHighlight_1 = (0, tslib_1.__importDefault)(require("./syntaxHighlight")); var htmlToElement_1 = (0, tslib_1.__importDefault)(require("../core/htmlToElement")); var getElementByHook_1 = (0, tslib_1.__importDefault)(require("../core/getElementByHook")); var toggleElementClass_1 = (0, tslib_1.__importDefault)(require("../core/toggleElementClass")); var debug_panel_scss_1 = (0, tslib_1.__importDefault)(require("./debug-panel.scss")); var DebugPanelView = /** @class */ (function (_super) { (0, tslib_1.__extends)(DebugPanelView, _super); function DebugPanelView(config) { var _this = _super.call(this) || this; var callbacks = config.callbacks; _this._callbacks = callbacks; _this._initDOM(); _this._bindEvents(); return _this; } DebugPanelView.prototype._initDOM = function () { this._$rootElement = (0, htmlToElement_1.default)((0, templates_1.debugPanelTemplate)({ styles: this.styleNames, })); this._$closeButton = (0, getElementByHook_1.default)(this._$rootElement, 'debug-panel-close-button'); this._$infoContainer = (0, getElementByHook_1.default)(this._$rootElement, 'debug-panel-info-container'); }; DebugPanelView.prototype._bindEvents = function () { this._$closeButton.addEventListener('click', this._callbacks.onCloseButtonClick); }; DebugPanelView.prototype._unbindEvents = function () { this._$closeButton.removeEventListener('click', this._callbacks.onCloseButtonClick); }; DebugPanelView.prototype.show = function () { (0, toggleElementClass_1.default)(this._$rootElement, this.styleNames.hidden, false); }; DebugPanelView.prototype.hide = function () { (0, toggleElementClass_1.default)(this._$rootElement, this.styleNames.hidden, true); }; DebugPanelView.prototype.setInfo = function (info) { this._$infoContainer.innerHTML = (0, syntaxHighlight_1.default)(JSON.stringify(info, undefined, 4), this.styleNames); }; DebugPanelView.prototype.getElement = function () { return this._$rootElement; }; DebugPanelView.prototype.destroy = function () { this._unbindEvents(); if (this._$rootElement.parentNode) { this._$rootElement.parentNode.removeChild(this._$rootElement); } this._$rootElement = null; this._$closeButton = null; this._$infoContainer = null; }; return DebugPanelView; }(view_1.default)); DebugPanelView.extendStyleNames(debug_panel_scss_1.default); exports.default = DebugPanelView; //# sourceMappingURL=debug-panel.view.js.map