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
265 }265 }
266 266
267 version(doc, fn) {267 version(doc, fn) {
268 let version = this.cachedVersion(doc);268 const version = this.cachedVersion(doc);
269 if (version != null) {269 if (version != null) {
270 fn(version);270 fn(version);
271 return;271 return;
@@ -302,7 +302,7 @@ app.DB = class DB { · 30 unmodified lines
302 }302 }
303 303
304 versions(docs, fn) {304 versions(docs, fn) {
305 let versions = this.cachedVersions(docs);305 const versions = this.cachedVersions(docs);
306 if (versions) {306 if (versions) {
307 fn(versions);307 fn(versions);
308 return;308 return;
@@ -324,7 +324,7 @@ app.DB = class DB { · 15 unmodified lines
324 const store = txn.objectStore("docs");324 const store = txn.objectStore("docs");
325 var result = {};325 var result = {};
326 326
327 docs.forEach(function (doc) {327 docs.forEach((doc) => {
328 const req = store.get(doc.slug);328 const req = store.get(doc.slug);
329 req.onsuccess = function () {329 req.onsuccess = function () {
330 result[doc.slug] = req.result;330 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
21 return;21 return;
22 }22 }
23 this.notifyUpdate = true;23 this.notifyUpdate = true;
24 return this.registration.update().catch(function () {});24 return this.registration.update().catch(() => {});
25 }25 }
26 26
27 updateInBackground() {27 updateInBackground() {
@@ -29,7 +29,7 @@ app.ServiceWorker = class ServiceWorker extends Events { · 1 unmodified line
29 return;29 return;
30 }30 }
31 this.notifyUpdate = false;31 this.notifyUpdate = false;
32 return this.registration.update().catch(function () {});32 return this.registration.update().catch(() => {});
33 }33 }
34 34
35 reload() {35 reload() {
assets/javascripts/collections/docs.js+2−2
@@ -13,7 +13,7 @@ app.collections.Docs = class Docs extends app.Collection { · 12 unmodified lines
13 );13 );
14 }14 }
15 sort() {15 sort() {
16 return this.models.sort(function (a, b) {16 return this.models.sort((a, b) => {
17 if (a.name === b.name) {17 if (a.name === b.name) {
18 if (18 if (
19 !a.version ||19 !a.version ||
@@ -81,7 +81,7 @@ app.collections.Docs = class Docs extends app.Collection { · 61 unmodified lines
81 }81 }
82 82
83 getInstallStatuses(callback) {83 getInstallStatuses(callback) {
84 app.db.versions(this.models, function (statuses) {84 app.db.versions(this.models, (statuses) => {
85 if (statuses) {85 if (statuses) {
86 for (var key in statuses) {86 for (var key in statuses) {
87 var value = statuses[key];87 var value = statuses[key];
assets/javascripts/lib/events.js+1−1
@@ -34,7 +34,7 @@ class Events { · 33 unmodified lines
34 this.eventInProgress = { name: event, args };34 this.eventInProgress = { name: event, args };
35 const callbacks = this._callbacks?.[event];35 const callbacks = this._callbacks?.[event];
36 if (callbacks) {36 if (callbacks) {
37 for (let callback of callbacks.slice(0)) {37 for (const callback of callbacks.slice(0)) {
38 if (typeof callback === "function") {38 if (typeof callback === "function") {
39 callback(...args);39 callback(...args);
40 }40 }
assets/javascripts/lib/page.js+1−1
@@ -215,7 +215,7 @@ var pathToRegexp = function (path, keys) { · 214 unmodified lines
215 .replace(/\/\(/g, "(?:/")215 .replace(/\/\(/g, "(?:/")
216 .replace(216 .replace(
217 /(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,217 /(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,
218 function (_, slash, format, key, capture, optional) {218 (_, slash, format, key, capture, optional) => {
219 if (slash == null) {219 if (slash == null) {
220 slash = "";220 slash = "";
221 }221 }
assets/javascripts/views/layout/document.js+1−1
@@ -58,7 +58,7 @@ app.views.Document = class Document extends app.View { · 57 unmodified lines
58 if (this.el.visibilityState !== "visible") {58 if (this.el.visibilityState !== "visible") {
59 return;59 return;
60 }60 }
61 this.delay(function () {61 this.delay(() => {
62 if (app.isMobile() !== app.views.Mobile.detect()) {62 if (app.isMobile() !== app.views.Mobile.detect()) {
63 location.reload();63 location.reload();
64 }64 }
assets/javascripts/views/layout/settings.js+1−1
@@ -72,7 +72,7 @@ app.views.Settings = class Settings extends app.View { · 71 unmodified lines
72 return result;72 return result;
73 })(),73 })(),
74 );74 );
75 disabledDocs.uninstall(function () {75 disabledDocs.uninstall(() => {
76 app.db.migrate();76 app.db.migrate();
77 return app.reload();77 return app.reload();
78 });78 });
assets/javascripts/views/misc/news.js+1−1
@@ -18,7 +18,7 @@ app.views.News = class News extends app.views.Notif { · 17 unmodified lines
18 }18 }
19 19
20 getUnreadNews() {20 getUnreadNews() {
21 let time = this.getLastReadTime();21 const time = this.getLastReadTime();
22 if (!time) {22 if (!time) {
23 return [];23 return [];
24 }24 }
assets/javascripts/views/search/search.js+1−1
@@ -207,7 +207,7 @@ app.views.Search = class Search extends app.View { · 206 unmodified lines
207 }207 }
208 208
209 extractHashValue() {209 extractHashValue() {
210 let value = this.getHashValue();210 const value = this.getHashValue();
211 if (value != null) {211 if (value != null) {
212 app.router.replaceHash();212 app.router.replaceHash();
213 return value;213 return value;