History

Use const, use arrow callbacks

Simon Legner committed 2 years ago

Commit 9f87a451 parent 82fd7e69 files · +13 −13Browse files

Unified · Split

9 files
  1. assets/javascripts/app/db.js +3 −3
  2. assets/javascripts/app/serviceworker.js +2 −2
  3. assets/javascripts/collections/docs.js +2 −2
  4. assets/javascripts/lib/events.js +1 −1
  5. assets/javascripts/lib/page.js +1 −1
  6. assets/javascripts/views/layout/document.js +1 −1
  7. assets/javascripts/views/layout/settings.js +1 −1
  8. assets/javascripts/views/misc/news.js +1 −1
  9. assets/javascripts/views/search/search.js +1 −1
assets/javascripts/app/db.js+3−3
@@ -265,7 +265,7 @@ app.DB = class DB { · 264 unmodified lines
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 { · 30 unmodified lines
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 { · 15 unmodified lines
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+2−2
@@ -21,7 +21,7 @@ app.ServiceWorker = class ServiceWorker extends Events { · 20 unmodified lines
2121 return;
2222 }
2323 this.notifyUpdate = true;
24− return this.registration.update().catch(function () {});
24+ return this.registration.update().catch(() => {});
2525 }
2626
2727 updateInBackground() {
@@ -29,7 +29,7 @@ app.ServiceWorker = class ServiceWorker extends Events { · 1 unmodified line
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+2−2
@@ -13,7 +13,7 @@ app.collections.Docs = class Docs extends app.Collection { · 12 unmodified lines
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 { · 61 unmodified lines
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+1−1
@@ -34,7 +34,7 @@ class Events { · 33 unmodified lines
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+1−1
@@ -215,7 +215,7 @@ var pathToRegexp = function (path, keys) { · 214 unmodified lines
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+1−1
@@ -58,7 +58,7 @@ app.views.Document = class Document extends app.View { · 57 unmodified lines
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+1−1
@@ -72,7 +72,7 @@ app.views.Settings = class Settings extends app.View { · 71 unmodified lines
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+1−1
@@ -18,7 +18,7 @@ app.views.News = class News extends app.views.Notif { · 17 unmodified lines
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+1−1
@@ -207,7 +207,7 @@ app.views.Search = class Search extends app.View { · 206 unmodified lines
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;