From 94fd5c12c8b0b8dbecc3356070a7394f2e11a082 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Wed, 11 Jan 2017 16:26:24 -0500 Subject: [PATCH] fix: give techs a name (#3934) This helps with debugging to know what a component's name is. We try to look up the tech's name via the constructor's name property, otherwise, we set it to 'Unknown Tech'. Can be overridden by setting `this.name_` after calling `super()` in the constructor. Fixes #1786. --- src/js/tech/tech.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/js/tech/tech.js b/src/js/tech/tech.js index 633851eea1..29a62f7304 100644 --- a/src/js/tech/tech.js +++ b/src/js/tech/tech.js @@ -145,6 +145,10 @@ class Tech extends Component { if (!options.nativeControlsForTouch) { this.emitTapEvents(); } + + if (this.constructor) { + this.name_ = this.constructor.name || 'Unknown Tech'; + } } /* Fallbacks for unsupported event types