Showing the changes to assets/javascripts (1 of 1 file). Show all
Unified · Split
| @@ -1,13 +1,3 @@ | ||
| 1 | −// TODO: This file was created by bulk-decaffeinate. | |
| 2 | −// Sanity-check the conversion and remove this comment. | |
| 3 | −/* | |
| 4 | − * decaffeinate suggestions: | |
| 5 | − * DS101: Remove unnecessary use of Array.from | |
| 6 | − * DS102: Remove unnecessary code created because of implicit returns | |
| 7 | − * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining | |
| 8 | − * DS207: Consider shorter variations of null checks | |
| 9 | − * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md | |
| 10 | − */ | |
| 11 | 1 | class App extends Events { |
| 12 | 2 | _$ = $; |
| 13 | 3 | _$$ = $$; |
| @@ -81,10 +71,7 @@ class App extends Events { · 67 unmodified lines | ||
| 81 | 71 | tags: { |
| 82 | 72 | mode: this.isSingleDoc() ? "single" : "full", |
| 83 | 73 | iframe: (window.top !== window).toString(), |
| 84 | − electron: (!!__guard__( | |
| 85 | − window.process != null ? window.process.versions : undefined, | |
| 86 | − (x) => x.electron, | |
| 87 | − )).toString(), | |
| 74 | + electron: (!!window.process?.versions?.electron).toString(), | |
| 88 | 75 | }, |
| 89 | 76 | shouldSendCallback: () => { |
| 90 | 77 | try { |
| @@ -131,7 +118,7 @@ class App extends Events { · 40 unmodified lines | ||
| 131 | 118 | |
| 132 | 119 | bootAll() { |
| 133 | 120 | const docs = this.settings.getDocs(); |
| 134 | − for (var doc of Array.from(this.DOCS)) { | |
| 121 | + for (var doc of this.DOCS) { | |
| 135 | 122 | (docs.indexOf(doc.slug) >= 0 ? this.docs : this.disabledDocs).add(doc); |
| 136 | 123 | } |
| 137 | 124 | this.migrateDocs(); |
| @@ -144,13 +131,13 @@ class App extends Events { · 6 unmodified lines | ||
| 144 | 131 | |
| 145 | 132 | start() { |
| 146 | 133 | let doc; |
| 147 | − for (doc of Array.from(this.docs.all())) { | |
| 134 | + for (doc of this.docs.all()) { | |
| 148 | 135 | this.entries.add(doc.toEntry()); |
| 149 | 136 | } |
| 150 | − for (doc of Array.from(this.disabledDocs.all())) { | |
| 137 | + for (doc of this.disabledDocs.all()) { | |
| 151 | 138 | this.entries.add(doc.toEntry()); |
| 152 | 139 | } |
| 153 | − for (doc of Array.from(this.docs.all())) { | |
| 140 | + for (doc of this.docs.all()) { | |
| 154 | 141 | this.initDoc(doc); |
| 155 | 142 | } |
| 156 | 143 | this.trigger("ready"); |
| @@ -165,7 +152,7 @@ class App extends Events { · 8 unmodified lines | ||
| 165 | 152 | } |
| 166 | 153 | |
| 167 | 154 | initDoc(doc) { |
| 168 | − for (var type of Array.from(doc.types.all())) { | |
| 155 | + for (var type of doc.types.all()) { | |
| 169 | 156 | doc.entries.add(type.toEntry()); |
| 170 | 157 | } |
| 171 | 158 | this.entries.add(doc.entries.all()); |
| @@ -173,7 +160,7 @@ class App extends Events { · 1 unmodified line | ||
| 173 | 160 | |
| 174 | 161 | migrateDocs() { |
| 175 | 162 | let needsSaving; |
| 176 | − for (var slug of Array.from(this.settings.getDocs())) { | |
| 163 | + for (var slug of this.settings.getDocs()) { | |
| 177 | 164 | if (!this.docs.findBy("slug", slug)) { |
| 178 | 165 | var doc; |
| 179 | 166 | |
| @@ -227,7 +214,7 @@ class App extends Events { · 47 unmodified lines | ||
| 227 | 214 | } |
| 228 | 215 | |
| 229 | 216 | saveDocs() { |
| 230 | − this.settings.setDocs(Array.from(this.docs.all()).map((doc) => doc.slug)); | |
| 217 | + this.settings.setDocs(this.docs.all().map((doc) => doc.slug)); | |
| 231 | 218 | this.db.migrate(); |
| 232 | 219 | return this.serviceWorker != null |
| 233 | 220 | ? this.serviceWorker.updateInBackground() |
| @@ -333,11 +320,11 @@ class App extends Events { · 99 unmodified lines | ||
| 333 | 320 | if (this.cookieBlocked) { |
| 334 | 321 | return; |
| 335 | 322 | } |
| 336 | − if (this.isInjectionError(...Array.from(args || []))) { | |
| 323 | + if (this.isInjectionError(...args)) { | |
| 337 | 324 | this.onInjectionError(); |
| 338 | − } else if (this.isAppError(...Array.from(args || []))) { | |
| 325 | + } else if (this.isAppError(...args)) { | |
| 339 | 326 | if (typeof this.previousErrorHandler === "function") { |
| 340 | − this.previousErrorHandler(...Array.from(args || [])); | |
| 327 | + this.previousErrorHandler(...args); | |
| 341 | 328 | } |
| 342 | 329 | this.hideLoadingScreen(); |
| 343 | 330 | if (!this.errorNotif) { |
| @@ -387,9 +374,7 @@ Please check your browser extensions/addons. `); · 43 unmodified lines | ||
| 387 | 374 | insertAdjacentHTML: !!document.body.insertAdjacentHTML, |
| 388 | 375 | defaultPrevented: |
| 389 | 376 | document.createEvent("CustomEvent").defaultPrevented === false, |
| 390 | − cssVariables: !!__guardMethod__(CSS, "supports", (o) => | |
| 391 | − o.supports("(--t: 0)"), | |
| 392 | − ), | |
| 377 | + cssVariables: !!CSS.supports?.("(--t: 0)"), | |
| 393 | 378 | }; |
| 394 | 379 | |
| 395 | 380 | for (var key in features) { |
| @@ -434,21 +419,4 @@ Please check your browser extensions/addons. `); · 38 unmodified lines | ||
| 434 | 419 | } |
| 435 | 420 | } |
| 436 | 421 | |
| 437 | −function __guard__(value, transform) { | |
| 438 | − return typeof value !== "undefined" && value !== null | |
| 439 | − ? transform(value) | |
| 440 | − : undefined; | |
| 441 | −} | |
| 442 | −function __guardMethod__(obj, methodName, transform) { | |
| 443 | − if ( | |
| 444 | − typeof obj !== "undefined" && | |
| 445 | − obj !== null && | |
| 446 | − typeof obj[methodName] === "function" | |
| 447 | − ) { | |
| 448 | − return transform(obj, methodName); | |
| 449 | − } else { | |
| 450 | − return undefined; | |
| 451 | − } | |
| 452 | −} | |
| 453 | − | |
| 454 | 422 | this.app = new App(); |