1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

always use const when possible

This commit is contained in:
dkanada 2020-09-12 05:46:15 +09:00
parent eec822ef34
commit a5776e98a7
8 changed files with 80 additions and 80 deletions

View file

@ -19,14 +19,14 @@ export class ComicsPlayer {
play(options) {
this.progress = 0;
let elem = this.createMediaElement();
const elem = this.createMediaElement();
return this.setCurrentSrc(elem, options);
}
stop() {
this.unbindEvents();
let elem = this.mediaElement;
const elem = this.mediaElement;
if (elem) {
dialogHelper.close(elem);
this.mediaElement = null;
@ -40,7 +40,7 @@ export class ComicsPlayer {
}
onWindowKeyUp(e) {
let key = keyboardnavigation.getKeyName(e);
const key = keyboardnavigation.getKeyName(e);
switch (key) {
case 'Escape':
this.stop();
@ -87,20 +87,20 @@ export class ComicsPlayer {
}
setCurrentSrc(elem, options) {
let item = options.items[0];
const item = options.items[0];
this.currentItem = item;
loading.show();
let serverId = item.ServerId;
let apiClient = window.connectionManager.getApiClient(serverId);
const serverId = item.ServerId;
const apiClient = window.connectionManager.getApiClient(serverId);
libarchive.Archive.init({
workerUrl: appRouter.baseUrl() + '/libraries/worker-bundle.js'
});
return new Promise((resolve, reject) => {
let downloadUrl = apiClient.getItemDownloadUrl(item.Id);
const downloadUrl = apiClient.getItemDownloadUrl(item.Id);
const archiveSource = new ArchiveSource(downloadUrl);
var instance = this;
@ -169,18 +169,18 @@ class ArchiveSource {
}
async load() {
let res = await fetch(this.url);
const res = await fetch(this.url);
if (!res.ok) {
return;
}
let blob = await res.blob();
const blob = await res.blob();
this.archive = await libarchive.Archive.open(blob);
this.raw = await this.archive.getFilesArray();
this.numberOfFiles = this.raw.length;
await this.archive.extractFiles();
let files = await this.archive.getFilesArray();
const files = await this.archive.getFilesArray();
files.sort((a, b) => {
if (a.file.name < b.file.name) {
return -1;
@ -189,9 +189,9 @@ class ArchiveSource {
}
});
for (let file of files) {
for (const file of files) {
/* eslint-disable-next-line compat/compat */
let url = URL.createObjectURL(file.file);
const url = URL.createObjectURL(file.file);
this.urls.push(url);
}
}