export default class DownloadListRow extends HTMLTableRowElement { constructor() { super(); this.downloadId = this.getAttribute('download-id'); this.imdbId = this.getAttribute('imdb-id'); this.mediaTitle = this.getAttribute('media-title'); this.url = this.getAttribute('url'); this.filename = this.getAttribute('filename'); this.status = this.getAttribute('status'); this.progress = this.getAttribute('progress'); this.mediaType = this.getAttribute('media-type'); this.episodeId = this.getAttribute('episode-id'); this.createdAt = this.getAttribute('created-at'); this.updatedAt = this.getAttribute('updated-at'); // this.previewContent = this.previewContent.bind(this); } static get observedAttributes() { return ['download-id', 'imdb-id', 'media-title', 'url', 'filename', 'status', 'progress', 'media-type', 'episode-id', 'created-at', 'updated-at']; } attributeChangedCallback(name, oldValue, newValue) { if (oldValue !== newValue) { this[name] = newValue; this.setAttribute(name, newValue); this.setPreviewContent(); } } setPreviewContent() { this.previewContent = `
ID
IMDB ID
Title
URL
Filename
Status
Progress
Media Type
Episode ID
Created At
Updated At
${this.getAttribute('download-id') ?? "-"}
${this.getAttribute('imdb-id') ?? "-"}
${this.getAttribute('media-title') ?? "-"}
${this.getAttribute('url') ?? "-"}
${this.getAttribute('filename') ?? "-"}
${this.getAttribute('status') ?? "-"}
${this.getAttribute('progress') ?? "-"}
${this.getAttribute('media-type') ?? "-"}
${this.getAttribute('episode-id') ?? "-"}
${this.getAttribute('created-at') ?? "-"}
${this.getAttribute('updated-at') ?? "-"}
`; } }