Skip to content

Commit 9f87a45

Browse files
committed
Use const, use arrow callbacks
1 parent 82fd7e6 commit 9f87a45

9 files changed

Lines changed: 13 additions & 13 deletions

File tree

assets/javascripts/app/db.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ app.DB = class DB {
265265
}
266266

267267
version(doc, fn) {
268-
let version = this.cachedVersion(doc);
268+
const version = this.cachedVersion(doc);
269269
if (version != null) {
270270
fn(version);
271271
return;
@@ -302,7 +302,7 @@ app.DB = class DB {
302302
}
303303

304304
versions(docs, fn) {
305-
let versions = this.cachedVersions(docs);
305+
const versions = this.cachedVersions(docs);
306306
if (versions) {
307307
fn(versions);
308308
return;
@@ -324,7 +324,7 @@ app.DB = class DB {
324324
const store = txn.objectStore("docs");
325325
var result = {};
326326

327-
docs.forEach(function (doc) {
327+
docs.forEach((doc) => {
328328
const req = store.get(doc.slug);
329329
req.onsuccess = function () {
330330
result[doc.slug] = req.result;

assets/javascripts/app/serviceworker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ app.ServiceWorker = class ServiceWorker extends Events {
2121
return;
2222
}
2323
this.notifyUpdate = true;
24-
return this.registration.update().catch(function () {});
24+
return this.registration.update().catch(() => {});
2525
}
2626

2727
updateInBackground() {
2828
if (!this.registration) {
2929
return;
3030
}
3131
this.notifyUpdate = false;
32-
return this.registration.update().catch(function () {});
32+
return this.registration.update().catch(() => {});
3333
}
3434

3535
reload() {

assets/javascripts/collections/docs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ app.collections.Docs = class Docs extends app.Collection {
1313
);
1414
}
1515
sort() {
16-
return this.models.sort(function (a, b) {
16+
return this.models.sort((a, b) => {
1717
if (a.name === b.name) {
1818
if (
1919
!a.version ||
@@ -81,7 +81,7 @@ app.collections.Docs = class Docs extends app.Collection {
8181
}
8282

8383
getInstallStatuses(callback) {
84-
app.db.versions(this.models, function (statuses) {
84+
app.db.versions(this.models, (statuses) => {
8585
if (statuses) {
8686
for (var key in statuses) {
8787
var value = statuses[key];

assets/javascripts/lib/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Events {
3434
this.eventInProgress = { name: event, args };
3535
const callbacks = this._callbacks?.[event];
3636
if (callbacks) {
37-
for (let callback of callbacks.slice(0)) {
37+
for (const callback of callbacks.slice(0)) {
3838
if (typeof callback === "function") {
3939
callback(...args);
4040
}

assets/javascripts/lib/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ var pathToRegexp = function (path, keys) {
215215
.replace(/\/\(/g, "(?:/")
216216
.replace(
217217
/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,
218-
function (_, slash, format, key, capture, optional) {
218+
(_, slash, format, key, capture, optional) => {
219219
if (slash == null) {
220220
slash = "";
221221
}

assets/javascripts/views/layout/document.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ app.views.Document = class Document extends app.View {
5858
if (this.el.visibilityState !== "visible") {
5959
return;
6060
}
61-
this.delay(function () {
61+
this.delay(() => {
6262
if (app.isMobile() !== app.views.Mobile.detect()) {
6363
location.reload();
6464
}

assets/javascripts/views/layout/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ app.views.Settings = class Settings extends app.View {
7272
return result;
7373
})(),
7474
);
75-
disabledDocs.uninstall(function () {
75+
disabledDocs.uninstall(() => {
7676
app.db.migrate();
7777
return app.reload();
7878
});

assets/javascripts/views/misc/news.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ app.views.News = class News extends app.views.Notif {
1818
}
1919

2020
getUnreadNews() {
21-
let time = this.getLastReadTime();
21+
const time = this.getLastReadTime();
2222
if (!time) {
2323
return [];
2424
}

assets/javascripts/views/search/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ app.views.Search = class Search extends app.View {
207207
}
208208

209209
extractHashValue() {
210-
let value = this.getHashValue();
210+
const value = this.getHashValue();
211211
if (value != null) {
212212
app.router.replaceHash();
213213
return value;

0 commit comments

Comments
 (0)