loading: fix cancel button broken by worker-based loading

This commit is contained in:
Ilya Kreymer
2021-11-27 17:25:10 -08:00
parent 178d0507eb
commit b60a0ee7d3
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -59,6 +59,7 @@ class Loader extends LitElement
// if (!navigator.serviceWorker) {
// return;
// }
// eslint-disable-next-line no-undef
this.worker = new Worker(__SW_NAME__);
this.worker.addEventListener("message", (event) => {
@@ -214,7 +215,7 @@ You can select a file to upload from the main page by clicking the 'Choose File.
onCancel() {
//if (navigator.serviceWorker && navigator.serviceWorker.controller) {
if (this.worker) {
this.worker.controller.postMessage({"msg_type": "cancelLoad", "name": this.coll});
this.worker.postMessage({"msg_type": "cancelLoad", "name": this.coll});
// if (this.pingInterval) {
// clearInterval(this.pingInterval);
// }