Fixed TypeScript 3 warnings
This commit is contained in:
parent
f0625aabe5
commit
60a26c39f4
@ -53,7 +53,8 @@ function uploadFile(file: File, fileType: string, endpoint: string, arn: AnimeNo
|
|||||||
let reader = new FileReader()
|
let reader = new FileReader()
|
||||||
|
|
||||||
reader.onloadend = async () => {
|
reader.onloadend = async () => {
|
||||||
let fileSize = reader.result.byteLength
|
let result = reader.result as ArrayBuffer
|
||||||
|
let fileSize = result.byteLength
|
||||||
|
|
||||||
if(fileSize === 0) {
|
if(fileSize === 0) {
|
||||||
arn.statusMessage.showError("File is empty")
|
arn.statusMessage.showError("File is empty")
|
||||||
@ -96,6 +97,8 @@ function previewImage(file: File, endpoint: string, previews: HTMLCollectionOf<E
|
|||||||
let reader = new FileReader()
|
let reader = new FileReader()
|
||||||
|
|
||||||
reader.onloadend = () => {
|
reader.onloadend = () => {
|
||||||
|
let dataURL = reader.result as string
|
||||||
|
|
||||||
if(endpoint === "/api/upload/avatar") {
|
if(endpoint === "/api/upload/avatar") {
|
||||||
let svgPreview = document.getElementById("avatar-input-preview-svg") as HTMLImageElement
|
let svgPreview = document.getElementById("avatar-input-preview-svg") as HTMLImageElement
|
||||||
|
|
||||||
@ -114,7 +117,7 @@ function previewImage(file: File, endpoint: string, previews: HTMLCollectionOf<E
|
|||||||
img.classList.add("element-found")
|
img.classList.add("element-found")
|
||||||
}
|
}
|
||||||
|
|
||||||
img.src = reader.result
|
img.src = dataURL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export default class ServiceWorkerManager {
|
|||||||
navigator.serviceWorker.controller.postMessage(JSON.stringify(message))
|
navigator.serviceWorker.controller.postMessage(JSON.stringify(message))
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessage(evt: ServiceWorkerMessageEvent) {
|
onMessage(evt: MessageEvent) {
|
||||||
let message = JSON.parse(evt.data)
|
let message = JSON.parse(evt.data)
|
||||||
|
|
||||||
switch(message.type) {
|
switch(message.type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user