Browse Source

class View extends Events

Simon Legner 1 year ago
parent
commit
5e0b6a4e59
1 changed files with 3 additions and 8 deletions
  1. 3 8
      assets/javascripts/views/view.js

+ 3 - 8
assets/javascripts/views/view.js

@@ -4,16 +4,12 @@
  * decaffeinate suggestions:
  * DS101: Remove unnecessary use of Array.from
  * DS102: Remove unnecessary code created because of implicit returns
- * DS206: Consider reworking classes to avoid initClass
  * DS207: Consider shorter variations of null checks
  * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
  */
-app.View = class View {
-  static initClass() {
-    $.extend(this.prototype, Events);
-  }
-
+app.View = class View extends Events {
   constructor(el) {
+    super();
     if (el instanceof HTMLElement) {
       this.el = el;
     }
@@ -27,8 +23,8 @@ app.View = class View {
     this.refreshElements();
     if (typeof this.init === "function") {
       this.init();
+      this.refreshElements();
     }
-    this.refreshElements();
   }
 
   setupElement() {
@@ -260,4 +256,3 @@ app.View = class View {
     $.remove(this.el);
   }
 };
-app.View.initClass();