From da10e5ce038a4e7786d5ff9fb1f7d1e62c8f71b9 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sat, 6 Jan 2024 13:56:45 +0100 Subject: [PATCH] class Router extends Events --- assets/javascripts/app/router.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/app/router.js b/assets/javascripts/app/router.js index a02fd8df..395b56cf 100644 --- a/assets/javascripts/app/router.js +++ b/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)); }