50 lines
2.4 KiB
JavaScript
50 lines
2.4 KiB
JavaScript
"use strict";
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||
};
|
||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.Init = void 0;
|
||
var OptionParams_model_1 = require("./model/OptionParams.model");
|
||
var index_config_1 = require("./config/index.config");
|
||
var index_ui_1 = require("./ui/index.ui");
|
||
var Ioc_annotation_1 = require("./annotation/Ioc.annotation");
|
||
/**
|
||
* 核心必传参数的校验
|
||
*/
|
||
var Init = /** @class */ (function () {
|
||
function Init(OptionParams) {
|
||
this.OptionParams = OptionParams;
|
||
this.checkParams();
|
||
}
|
||
Init.prototype.checkParams = function () {
|
||
if (this.OptionParams.hasOwnProperty("el") && this.OptionParams.hasOwnProperty("url")) {
|
||
if (this.OptionParams.controls && Object.keys(this.OptionParams.controls).length == 0) {
|
||
throw new Error("请勿传入空controls的配置");
|
||
}
|
||
this.OptionParams.playList === undefined
|
||
? delete index_config_1.Config.DefalutOptionParams.playList
|
||
: null;
|
||
// 将用户传入的参数和默认参数进行合并,如果值冲突,优先采用用户的配置来覆盖默认值
|
||
Object.assign(index_config_1.Config.DefalutOptionParams, this.OptionParams);
|
||
// 保存配置到存取器,供全局使用
|
||
OptionParams_model_1.default.OptionParams = index_config_1.Config.DefalutOptionParams;
|
||
this.ApplicationUI.GenerateDom();
|
||
}
|
||
else {
|
||
throw new Error("请检查必传参数:el 和 url,是否传入!");
|
||
}
|
||
};
|
||
__decorate([
|
||
Ioc_annotation_1.Inject(),
|
||
__metadata("design:type", index_ui_1.ApplicationUI)
|
||
], Init.prototype, "ApplicationUI", void 0);
|
||
return Init;
|
||
}());
|
||
exports.Init = Init;
|