浏览代码

[ts] Better error when parent element is not found.

Nathan Sweet 4 年之前
父节点
当前提交
1bde7527c9
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      spine-ts/player/src/Player.ts

+ 1 - 0
spine-ts/player/src/Player.ts

@@ -217,6 +217,7 @@ module spine {
 
 		constructor (parent: HTMLElement | string, private config: SpinePlayerConfig) {
 			this.parent = typeof parent === "string" ? document.getElementById(parent) : parent;
+			if (!this.parent) throw new Error("SpinePlayer parent not found: " + parent);
 
 			if (config.showControls === void 0) config.showControls = true;
 			let controls = config.showControls ? /*html*/`