core-cde
Version:
56 lines • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageWidget = void 0;
const BaseWidget_1 = require("../BaseWidget");
const Errors_1 = require("../Errors");
class ImageWidget extends BaseWidget_1.BaseWidget {
constructor(type, id) {
super(type, id);
}
get width() {
return this._width;
}
set width(value) {
this._width = value;
}
get height() {
return this._height;
}
set height(value) {
this._height = value;
}
get data() {
return this._data;
}
set data(value) {
this._data = value;
}
/**
* Получить объект класса ImageWidget из json
* @param json валидная json строка
* @returns объект класса ImageWidget
*/
static fromJSON(json) {
try {
return Object.assign(new ImageWidget(null, null), JSON.parse(json));
}
catch (error) {
throw new Errors_1.JsonParseError('ImageWidget widget');
}
}
/**
* Получить объект для сериализации
* @returns Объект для сериализации
*/
toJSON() {
return Object.assign({}, null, {
id: this.id,
type: this.type,
_data: this._data,
_height: this._height,
_width: this._width,
});
}
}
exports.ImageWidget = ImageWidget;
//# sourceMappingURL=Image.js.map