Skip to content

Commit

Permalink
fix: give techs a name (#3934)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gkatsev committed Jan 11, 2017
1 parent 2ceed0a commit 94fd5c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/js/tech/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 94fd5c1

Please sign in to comment.