js: Check for this.constructor type instead of new.target
Use more ES6-inspired check for classes initializations. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
This commit is contained in:
@ -98,8 +98,8 @@ function clamp(value, min, max) {
|
||||
|
||||
class BaseAppView {
|
||||
constructor(params, gridParams) {
|
||||
if (new.target === BaseAppView)
|
||||
throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
|
||||
if (this.constructor === BaseAppView)
|
||||
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
|
||||
|
||||
gridParams = Params.parse(gridParams, { xAlign: St.Align.MIDDLE,
|
||||
columnLimit: MAX_COLUMNS,
|
||||
|
Reference in New Issue
Block a user