Pārlūkot izejas kodu

class Router extends Events

Simon Legner 1 gadu atpakaļ
vecāks
revīzija
da10e5ce03
1 mainītis faili ar 2 papildinājumiem un 3 dzēšanām
  1. 2 3
      assets/javascripts/app/router.js

+ 2 - 3
assets/javascripts/app/router.js

@@ -9,10 +9,8 @@
  * DS207: Consider shorter variations of null checks
  * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
  */
-app.Router = class Router {
+app.Router = class Router extends Events {
   static initClass() {
-    $.extend(this.prototype, Events);
-
     this.routes = [
       ["*", "before"],
       ["/", "root"],
@@ -29,6 +27,7 @@ app.Router = class Router {
   }
 
   constructor() {
+    super();
     for (var [path, method] of Array.from(this.constructor.routes)) {
       page(path, this[method].bind(this));
     }