Skip to content

Commit 845709b

Browse files
committed
Fix app.View constructors
1 parent 917a8b6 commit 845709b

31 files changed

+192
-165
lines changed

assets/javascripts/views/content/content.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,8 @@
99
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
1010
*/
1111
app.views.Content = class Content extends app.View {
12-
constructor(...args) {
13-
super(...args);
14-
this.scrollToTop = this.scrollToTop.bind(this);
15-
this.scrollToBottom = this.scrollToBottom.bind(this);
16-
this.scrollStepUp = this.scrollStepUp.bind(this);
17-
this.scrollStepDown = this.scrollStepDown.bind(this);
18-
this.scrollPageUp = this.scrollPageUp.bind(this);
19-
this.scrollPageDown = this.scrollPageDown.bind(this);
20-
this.onReady = this.onReady.bind(this);
21-
this.onBootError = this.onBootError.bind(this);
22-
this.onEntryLoading = this.onEntryLoading.bind(this);
23-
this.onEntryLoaded = this.onEntryLoaded.bind(this);
24-
this.beforeRoute = this.beforeRoute.bind(this);
25-
this.afterRoute = this.afterRoute.bind(this);
26-
this.onClick = this.onClick.bind(this);
27-
this.onAltF = this.onAltF.bind(this);
12+
constructor() {
13+
super();
2814
}
2915

3016
static initClass() {
@@ -50,6 +36,21 @@ app.views.Content = class Content extends app.View {
5036
}
5137

5238
init() {
39+
this.scrollToTop = this.scrollToTop.bind(this);
40+
this.scrollToBottom = this.scrollToBottom.bind(this);
41+
this.scrollStepUp = this.scrollStepUp.bind(this);
42+
this.scrollStepDown = this.scrollStepDown.bind(this);
43+
this.scrollPageUp = this.scrollPageUp.bind(this);
44+
this.scrollPageDown = this.scrollPageDown.bind(this);
45+
this.onReady = this.onReady.bind(this);
46+
this.onBootError = this.onBootError.bind(this);
47+
this.onEntryLoading = this.onEntryLoading.bind(this);
48+
this.onEntryLoaded = this.onEntryLoaded.bind(this);
49+
this.beforeRoute = this.beforeRoute.bind(this);
50+
this.afterRoute = this.afterRoute.bind(this);
51+
this.onClick = this.onClick.bind(this);
52+
this.onAltF = this.onAltF.bind(this);
53+
5354
this.scrollEl = app.isMobile()
5455
? document.scrollingElement || document.body
5556
: this.el;

assets/javascripts/views/content/entry_page.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010
(function () {
1111
let LINKS = undefined;
1212
app.views.EntryPage = class EntryPage extends app.View {
13-
constructor(...args) {
14-
super(...args);
15-
this.beforeRoute = this.beforeRoute.bind(this);
16-
this.onSuccess = this.onSuccess.bind(this);
17-
this.onError = this.onError.bind(this);
18-
this.onClick = this.onClick.bind(this);
19-
this.onAltC = this.onAltC.bind(this);
20-
this.onAltO = this.onAltO.bind(this);
13+
constructor() {
14+
super();
2115
}
2216

2317
static initClass() {
@@ -40,6 +34,13 @@
4034
}
4135

4236
init() {
37+
this.beforeRoute = this.beforeRoute.bind(this);
38+
this.onSuccess = this.onSuccess.bind(this);
39+
this.onError = this.onError.bind(this);
40+
this.onClick = this.onClick.bind(this);
41+
this.onAltC = this.onAltC.bind(this);
42+
this.onAltO = this.onAltO.bind(this);
43+
4344
this.cacheMap = {};
4445
this.cacheStack = [];
4546
}

assets/javascripts/views/content/offline_page.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
77
*/
88
app.views.OfflinePage = class OfflinePage extends app.View {
9-
constructor(...args) {
10-
super(...args);
11-
this.onClick = this.onClick.bind(this);
9+
constructor() {
10+
super();
1211
}
1312

1413
static initClass() {
@@ -20,6 +19,10 @@ app.views.OfflinePage = class OfflinePage extends app.View {
2019
};
2120
}
2221

22+
init() {
23+
this.onClick = this.onClick.bind(this);
24+
}
25+
2326
deactivate() {
2427
if (super.deactivate(...arguments)) {
2528
this.empty();

assets/javascripts/views/content/root_page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
66
*/
77
app.views.RootPage = class RootPage extends app.View {
8-
constructor(...args) {
9-
super(...args);
8+
constructor() {
9+
super();
1010
this.onClick = this.onClick.bind(this);
1111
}
1212

assets/javascripts/views/content/settings_page.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
88
*/
99
app.views.SettingsPage = class SettingsPage extends app.View {
10-
constructor(...args) {
11-
super(...args);
12-
this.onChange = this.onChange.bind(this);
13-
this.onClick = this.onClick.bind(this);
10+
constructor() {
11+
super();
1412
}
1513

1614
static initClass() {
@@ -22,6 +20,11 @@ app.views.SettingsPage = class SettingsPage extends app.View {
2220
};
2321
}
2422

23+
init() {
24+
this.onChange = this.onChange.bind(this);
25+
this.onClick = this.onClick.bind(this);
26+
}
27+
2528
render() {
2629
this.html(this.tmpl("settingsPage", this.currentSettings()));
2730
}

assets/javascripts/views/layout/document.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
66
*/
77
app.views.Document = class Document extends app.View {
8-
constructor(...args) {
9-
super(...args);
10-
this.afterRoute = this.afterRoute.bind(this);
11-
this.onVisibilityChange = this.onVisibilityChange.bind(this);
8+
constructor() {
9+
super();
1210
}
1311

1412
static initClass() {
@@ -28,6 +26,9 @@ app.views.Document = class Document extends app.View {
2826
}
2927

3028
init() {
29+
this.afterRoute = this.afterRoute.bind(this);
30+
this.onVisibilityChange = this.onVisibilityChange.bind(this);
31+
3132
this.addSubview(
3233
(this.menu = new app.views.Menu()),
3334
this.addSubview((this.sidebar = new app.views.Sidebar()))

assets/javascripts/views/layout/menu.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
55
*/
66
app.views.Menu = class Menu extends app.View {
7-
constructor(...args) {
8-
super(...args);
9-
this.onGlobalClick = this.onGlobalClick.bind(this);
7+
constructor() {
8+
super();
109
}
1110

1211
static initClass() {
@@ -17,6 +16,8 @@ app.views.Menu = class Menu extends app.View {
1716
}
1817

1918
init() {
19+
this.onGlobalClick = this.onGlobalClick.bind(this);
20+
2021
$.on(document.body, "click", this.onGlobalClick);
2122
}
2223

assets/javascripts/views/layout/mobile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ app.views.Mobile = class Mobile extends app.View {
5252

5353
constructor() {
5454
super(document.documentElement);
55+
}
56+
57+
init() {
5558
this.showSidebar = this.showSidebar.bind(this);
5659
this.hideSidebar = this.hideSidebar.bind(this);
5760
this.onClickBack = this.onClickBack.bind(this);
@@ -62,10 +65,7 @@ app.views.Mobile = class Mobile extends app.View {
6265
this.onTapSearch = this.onTapSearch.bind(this);
6366
this.onEscape = this.onEscape.bind(this);
6467
this.afterRoute = this.afterRoute.bind(this);
65-
this.el = document.documentElement;
66-
}
6768

68-
init() {
6969
$.on($("._search"), "touchend", this.onTapSearch);
7070

7171
this.toggleSidebar = $("button[data-toggle-sidebar]");

assets/javascripts/views/layout/path.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
66
*/
77
app.views.Path = class Path extends app.View {
8-
constructor(...args) {
9-
super(...args);
10-
this.onClick = this.onClick.bind(this);
11-
this.afterRoute = this.afterRoute.bind(this);
8+
constructor() {
9+
super();
1210
}
1311

1412
static initClass() {
@@ -20,6 +18,11 @@ app.views.Path = class Path extends app.View {
2018
this.routes = { after: "afterRoute" };
2119
}
2220

21+
init() {
22+
this.onClick = this.onClick.bind(this);
23+
this.afterRoute = this.afterRoute.bind(this);
24+
}
25+
2326
render(...args) {
2427
this.html(this.tmpl("path", ...Array.from(args)));
2528
this.show();

assets/javascripts/views/layout/resizer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
let MIN = undefined;
99
let MAX = undefined;
1010
app.views.Resizer = class Resizer extends app.View {
11-
constructor(...args) {
12-
super(...args);
13-
this.onDragStart = this.onDragStart.bind(this);
14-
this.onDrag = this.onDrag.bind(this);
15-
this.onDragEnd = this.onDragEnd.bind(this);
11+
constructor() {
12+
super();
1613
}
1714

1815
static initClass() {
@@ -32,6 +29,10 @@
3229
}
3330

3431
init() {
32+
this.onDragStart = this.onDragStart.bind(this);
33+
this.onDrag = this.onDrag.bind(this);
34+
this.onDragEnd = this.onDragEnd.bind(this);
35+
3536
this.el.setAttribute("draggable", "true");
3637
this.appendTo($("._app"));
3738
}

0 commit comments

Comments
 (0)