History

class Router extends Events

Simon Legner committed 2 years ago

Commit da10e5c1 parent f839ec51 file · +2 −3Browse files

Unified · Split

assets/javascripts/app/router.js+2−3
@@ -9,10 +9,8 @@ · 8 unmodified lines
9 * DS207: Consider shorter variations of null checks9 * DS207: Consider shorter variations of null checks
10 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md10 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
11 */11 */
12app.Router = class Router {12app.Router = class Router extends Events {
13 static initClass() {13 static initClass() {
14 $.extend(this.prototype, Events);
15
16 this.routes = [14 this.routes = [
17 ["*", "before"],15 ["*", "before"],
18 ["/", "root"],16 ["/", "root"],
@@ -29,6 +27,7 @@ app.Router = class Router { · 10 unmodified lines
29 }27 }
30 28
31 constructor() {29 constructor() {
30 super();
32 for (var [path, method] of Array.from(this.constructor.routes)) {31 for (var [path, method] of Array.from(this.constructor.routes)) {
33 page(path, this[method].bind(this));32 page(path, this[method].bind(this));
34 }33 }