Explorar o código

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

Nathan Sweet %!s(int64=4) %!d(string=hai) anos
pai
achega
1bde7527c9
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  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*/`