[gnome-shell] CyclerPopup: Check for type using constructor
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] CyclerPopup: Check for type using constructor
- Date: Sat, 27 Apr 2019 05:44:02 +0000 (UTC)
commit 3a3f9aa008e709e0a3c3535434efffb0231e4279
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Thu Apr 18 15:50:21 2019 -0500
CyclerPopup: Check for type using constructor
Classes that are sub-classes of GObject don't use a constructor per se, so we
can't check for new.target (as this is undefined) in _init.
Then compare the current constructor name instead.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
js/ui/altTab.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index fb9c875c8..0212992be 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -477,8 +477,8 @@ var CyclerList = GObject.registerClass({
var CyclerPopup = GObject.registerClass(
class CyclerPopup extends SwitcherPopup.SwitcherPopup {
_init() {
- if (new.target === CyclerPopup)
- throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
+ if (this.constructor.name === CyclerPopup.prototype.constructor.name)
+ throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
super._init();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]